• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022-2023 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 * @file
18 * @kit AbilityKit
19 */
20
21/**
22 * Utility class used for handling objects that use the DataAbilityHelper scheme.
23 *
24 * @namespace dataUriUtils
25 * @syscap SystemCapability.Ability.AbilityRuntime.Core
26 * @since 9
27 */
28declare namespace dataUriUtils {
29  /**
30   * Obtains the ID attached to the end of the path component of the given uri.
31   *
32   * @param { string } uri - Indicates the uri object from which the ID is to be obtained.
33   * @returns { number } Returns the ID attached to the end of the path component;
34   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
35   * 2. Incorrect parameter types; 3. Parameter verification failed.
36   * @syscap SystemCapability.Ability.AbilityRuntime.Core
37   * @since 9
38   */
39  function getId(uri: string): number;
40
41  /**
42   * Attaches the given ID to the end of the path component of the given uri.
43   *
44   * @param { string } uri - Indicates the uri string from which the ID is to be obtained.
45   * @param { number } id - Indicates the ID to attach.
46   * @returns { string } Returns the uri object with the given ID attached.
47   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
48   * 2. Incorrect parameter types; 3. Parameter verification failed.
49   * @syscap SystemCapability.Ability.AbilityRuntime.Core
50   * @since 9
51   */
52  function attachId(uri: string, id: number): string;
53
54  /**
55   * Deletes the ID from the end of the path component of the given uri.
56   *
57   * @param { string } uri - Indicates the uri object from which the ID is to be deleted.
58   * @returns { string } Returns the uri object with the ID deleted.
59   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
60   * 2. Incorrect parameter types; 3. Parameter verification failed.
61   * @syscap SystemCapability.Ability.AbilityRuntime.Core
62   * @since 9
63   */
64  function deleteId(uri: string): string;
65
66  /**
67   * Updates the ID in the specified uri
68   *
69   * @param { string } uri - Indicates the uri object to be updated.
70   * @param { number } id - Indicates the new ID.
71   * @returns { string } Returns the updated uri object.
72   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
73   * 2. Incorrect parameter types; 3. Parameter verification failed.
74   * @syscap SystemCapability.Ability.AbilityRuntime.Core
75   * @since 9
76   */
77  function updateId(uri: string, id: number): string;
78}
79export default dataUriUtils;
80