• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 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 ArkData
19 */
20
21/**
22 * Indicates the common data types.
23 *
24 * @namespace commonType
25 * @syscap SystemCapability.DistributedDataManager.CommonType
26 * @crossplatform
27 * @since 11
28 */
29declare namespace commonType {
30  /**
31   * Describes the status of asset.
32   *
33   * @enum { number }
34   * @syscap SystemCapability.DistributedDataManager.CommonType
35   * @crossplatform
36   * @since 11
37   */
38  enum AssetStatus {
39    /**
40     * Means the status of asset is normal.
41     *
42     * @syscap SystemCapability.DistributedDataManager.CommonType
43     * @crossplatform
44     * @since 11
45     */
46    ASSET_NORMAL,
47
48    /**
49     * Means the asset needs to be inserted.
50     *
51     * @syscap SystemCapability.DistributedDataManager.CommonType
52     * @crossplatform
53     * @since 11
54     */
55    ASSET_INSERT,
56
57    /**
58     * Means the asset needs to be updated.
59     *
60     * @syscap SystemCapability.DistributedDataManager.CommonType
61     * @crossplatform
62     * @since 11
63     */
64    ASSET_UPDATE,
65
66    /**
67     * Means the asset needs to be deleted.
68     *
69     * @syscap SystemCapability.DistributedDataManager.CommonType
70     * @crossplatform
71     * @since 11
72     */
73    ASSET_DELETE,
74
75    /**
76     * Means the status of asset is abnormal.
77     *
78     * @syscap SystemCapability.DistributedDataManager.CommonType
79     * @crossplatform
80     * @since 11
81     */
82    ASSET_ABNORMAL,
83
84    /**
85     * Means the status of asset is downloading.
86     *
87     * @syscap SystemCapability.DistributedDataManager.CommonType
88     * @crossplatform
89     * @since 11
90     */
91    ASSET_DOWNLOADING
92  }
93
94  /**
95   * Information of the asset.
96   *
97   * @interface Asset
98   * @syscap SystemCapability.DistributedDataManager.CommonType
99   * @crossplatform
100   * @since 11
101   */
102  interface Asset {
103    /**
104     * The name of asset.
105     * @type { string }
106     * @syscap SystemCapability.DistributedDataManager.CommonType
107     * @crossplatform
108     * @since 11
109     */
110    name: string;
111
112    /**
113     * The uri of asset.
114     *
115     * @type { string }
116     * @syscap SystemCapability.DistributedDataManager.CommonType
117     * @crossplatform
118     * @since 11
119     */
120    uri: string;
121
122    /**
123     * The path of asset.
124     *
125     * @type { string }
126     * @syscap SystemCapability.DistributedDataManager.CommonType
127     * @crossplatform
128     * @since 11
129     */
130    path: string;
131
132    /**
133     * The created time of asset.
134     *
135     * @type { string }
136     * @syscap SystemCapability.DistributedDataManager.CommonType
137     * @crossplatform
138     * @since 11
139     */
140    createTime: string;
141
142    /**
143     * The modified time of asset. If this field changes, the asset is considered to have changed.
144     *
145     * @type { string }
146     * @syscap SystemCapability.DistributedDataManager.CommonType
147     * @crossplatform
148     * @since 11
149     */
150    modifyTime: string;
151
152    /**
153     * The size of asset. If this field changes, the asset is considered to have changed.
154     *
155     * @type { string }
156     * @syscap SystemCapability.DistributedDataManager.CommonType
157     * @crossplatform
158     * @since 11
159     */
160    size: string;
161
162    /**
163     * The status of asset.
164     *
165     * @type { ?AssetStatus }
166     * @syscap SystemCapability.DistributedDataManager.CommonType
167     * @crossplatform
168     * @since 11
169     */
170    status?: AssetStatus;
171  }
172
173  /**
174   * Indicates several assets
175   *
176   * @typedef { Array<Asset> }
177   * @syscap SystemCapability.DistributedDataManager.CommonType
178   * @crossplatform
179   * @since 11
180   */
181  type Assets = Array<Asset>;
182
183  /**
184   * Indicates possible value types.
185   *
186   * @typedef { null | number | string | boolean | Uint8Array | Asset | Assets }
187   * @syscap SystemCapability.DistributedDataManager.CommonType
188   * @crossplatform
189   * @since 11
190   */
191  type ValueType = null | number | string | boolean | Uint8Array | Asset | Assets;
192
193  /**
194   * Values in buckets are stored in key-value pairs.
195   *
196   * @typedef { Record<string, ValueType> }
197   * @syscap SystemCapability.DistributedDataManager.CommonType
198   * @crossplatform
199   * @since 11
200   */
201  type ValuesBucket = Record<string, ValueType>;
202}
203
204export default commonType;
205