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