• 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
16/**
17 * Utility class used for handling objects that use the DataAbilityHelper scheme.
18 * @name dataUriUtils
19 * @since 9
20 * @syscap SystemCapability.Ability.AbilityRuntime.Core
21 * @permission N/A
22 */
23 declare namespace dataUriUtils {
24    /**
25     * Obtains the ID attached to the end of the path component of the given uri.
26     *
27     * @since 9
28     * @syscap SystemCapability.Ability.AbilityRuntime.Core
29     * @param uri Indicates the uri object from which the ID is to be obtained.
30     * @returns Returns the ID attached to the end of the path component;
31     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
32     */
33    function getId(uri: string): number
34
35    /**
36     * Attaches the given ID to the end of the path component of the given uri.
37     *
38     * @since 9
39     * @syscap SystemCapability.Ability.AbilityRuntime.Core
40     * @param uri Indicates the uri string from which the ID is to be obtained.
41     * @param id Indicates the ID to attach.
42     * @returns Returns the uri object with the given ID attached.
43     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
44     */
45    function attachId(uri: string, id: number): string
46
47    /**
48     * Deletes the ID from the end of the path component of the given uri.
49     *
50     * @since 9
51     * @syscap SystemCapability.Ability.AbilityRuntime.Core
52     * @param uri Indicates the uri object from which the ID is to be deleted.
53     * @returns Returns the uri object with the ID deleted.
54     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
55     */
56    function deleteId(uri: string): string
57
58    /**
59     * Updates the ID in the specified uri
60     *
61     * @since 9
62     * @syscap SystemCapability.Ability.AbilityRuntime.Core
63     * @param uri Indicates the uri object to be updated.
64     * @param id Indicates the new ID.
65     * @returns Returns the updated uri object.
66     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
67     */
68    function updateId(uri: string, id: number): string
69
70  }
71  export default dataUriUtils;