• 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    /**
111     * The name of asset.
112     * @type { string | undefined }
113     * @syscap SystemCapability.DistributedDataManager.CommonType
114     * @crossplatform
115     * @since 12
116     */
117    name: string | undefined;
118
119    /**
120     * The uri of asset.
121     *
122     * @type { string }
123     * @syscap SystemCapability.DistributedDataManager.CommonType
124     * @crossplatform
125     * @since 11
126     */
127    /**
128     * The uri of asset.
129     *
130     * @type { string | undefined }
131     * @syscap SystemCapability.DistributedDataManager.CommonType
132     * @crossplatform
133     * @since 12
134     */
135    uri: string | undefined;
136
137    /**
138     * The path of asset.
139     *
140     * @type { string }
141     * @syscap SystemCapability.DistributedDataManager.CommonType
142     * @crossplatform
143     * @since 11
144     */
145    /**
146     * The path of asset.
147     *
148     * @type { string | undefined }
149     * @syscap SystemCapability.DistributedDataManager.CommonType
150     * @crossplatform
151     * @since 12
152     */
153    path: string | undefined;
154
155    /**
156     * The created time of asset.
157     *
158     * @type { string }
159     * @syscap SystemCapability.DistributedDataManager.CommonType
160     * @crossplatform
161     * @since 11
162     */
163    /**
164     * The created time of asset.
165     *
166     * @type { string | undefined }
167     * @syscap SystemCapability.DistributedDataManager.CommonType
168     * @crossplatform
169     * @since 12
170     */
171    createTime: string | undefined;
172
173    /**
174     * The modified time of asset. If this field changes, the asset is considered to have changed.
175     *
176     * @type { string }
177     * @syscap SystemCapability.DistributedDataManager.CommonType
178     * @crossplatform
179     * @since 11
180     */
181    /**
182     * The modified time of asset. If this field changes, the asset is considered to have changed.
183     *
184     * @type { string | undefined }
185     * @syscap SystemCapability.DistributedDataManager.CommonType
186     * @crossplatform
187     * @since 12
188     */
189    modifyTime: string | undefined;
190
191    /**
192     * The size of asset. If this field changes, the asset is considered to have changed.
193     *
194     * @type { string }
195     * @syscap SystemCapability.DistributedDataManager.CommonType
196     * @crossplatform
197     * @since 11
198     */
199    /**
200     * The size of asset. If this field changes, the asset is considered to have changed.
201     *
202     * @type { string | undefined }
203     * @syscap SystemCapability.DistributedDataManager.CommonType
204     * @crossplatform
205     * @since 12
206     */
207    size: string | undefined;
208
209    /**
210     * The status of asset.
211     *
212     * @type { ?AssetStatus }
213     * @syscap SystemCapability.DistributedDataManager.CommonType
214     * @crossplatform
215     * @since 11
216     */
217    /**
218     * The status of asset.
219     *
220     * @type { ?(AssetStatus | undefined) }
221     * @syscap SystemCapability.DistributedDataManager.CommonType
222     * @crossplatform
223     * @since 12
224     */
225    status?: AssetStatus | undefined;
226  }
227
228  /**
229   * Indicates several assets
230   *
231   * @syscap SystemCapability.DistributedDataManager.CommonType
232   * @crossplatform
233   * @since 11
234   */
235  type Assets = Array<Asset>;
236
237  /**
238   * Indicates possible value types.
239   *
240   * @syscap SystemCapability.DistributedDataManager.CommonType
241   * @crossplatform
242   * @since 11
243   */
244  type ValueType = null | number | string | boolean | Uint8Array | Asset | Assets;
245
246  /**
247   * Values in buckets are stored in key-value pairs.
248   *
249   * @syscap SystemCapability.DistributedDataManager.CommonType
250   * @crossplatform
251   * @since 11
252   */
253  type ValuesBucket = Record<string, ValueType>;
254}
255
256export default commonType;
257