• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import { AsyncCallback } from './@ohos.base';
17
18/**
19 * Provides file path related APIS.
20 *
21 * @namespace configPolicy
22 * @syscap SystemCapability.Customization.ConfigPolicy
23 * @systemapi
24 * @since 8
25 */
26declare namespace configPolicy {
27  /**
28   * Get file from the highest priority config path which contains the given file name.
29   *
30   * @param { string } relPath the relative path of the config file.
31   * @param { AsyncCallback<string> } callback contains the path of the highest priority config file.
32   * @throws { BusinessError } 401 - invalid input parameter.
33   * @syscap SystemCapability.Customization.ConfigPolicy
34   * @systemapi Hide this for inner system use.
35   * @since 8
36   */
37  function getOneCfgFile(relPath: string, callback: AsyncCallback<string>);
38
39  /**
40   * Get file from the highest priority config path which contains the given file name.
41   *
42   * @param { string } relPath the relative path of the config file.
43   * @returns { Promise<string> } the promise returns the path of the highest priority config file.
44   * @throws { BusinessError } 401 - invalid input parameter.
45   * @syscap SystemCapability.Customization.ConfigPolicy
46   * @systemapi Hide this for inner system use.
47   * @since 8
48   */
49  function getOneCfgFile(relPath: string): Promise<string>;
50
51  /**
52   * Get config files in device architecture, ordered by priority from low to high.
53   *
54   * @param { string } relPath the relative path of the config file.
55   * @param { AsyncCallback<Array<string>> } callback contains paths of config files.
56   * @throws { BusinessError } 401 - invalid input parameter.
57   * @syscap SystemCapability.Customization.ConfigPolicy
58   * @systemapi Hide this for inner system use.
59   * @since 8
60   */
61  function getCfgFiles(relPath: string, callback: AsyncCallback<Array<string>>);
62
63  /**
64   * Get config files in device architecture, ordered by priority from low to high.
65   *
66   * @param { string } relPath the relative path of the config file.
67   * @returns { Promise<Array<string>> } the promise returns paths of config files.
68   * @throws { BusinessError } 401 - invalid input parameter.
69   * @syscap SystemCapability.Customization.ConfigPolicy
70   * @systemapi Hide this for inner system use.
71   * @since 8
72   */
73  function getCfgFiles(relPath: string): Promise<Array<string>>;
74
75  /**
76   * Get config directories in device architecture, ordered by priority from low to high.
77   *
78   * @param { AsyncCallback<Array<string>> } callback contains paths of config directories.
79   * @throws { BusinessError } 401 - invalid input parameter.
80   * @syscap SystemCapability.Customization.ConfigPolicy
81   * @systemapi Hide this for inner system use.
82   * @since 8
83   */
84  function getCfgDirList(callback: AsyncCallback<Array<string>>);
85
86  /**
87   * Get config directories in device architecture, ordered by priority from low to high.
88   *
89   * @returns { Promise<Array<string>> } the promise returns paths of config directories.
90   * @throws { BusinessError } 401 - invalid input parameter.
91   * @syscap SystemCapability.Customization.ConfigPolicy
92   * @systemapi Hide this for inner system use.
93   * @since 8
94   */
95  function getCfgDirList(): Promise<Array<string>>;
96}
97
98export default configPolicy;
99