• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2024 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
21import image from './@ohos.multimedia.image';
22
23/**
24 * Provide uniform data struct definition.
25 *
26 * @namespace uniformDataStruct
27 * @syscap SystemCapability.DistributedDataManager.UDMF.Core
28 * @since 12
29 */
30declare namespace uniformDataStruct {
31  /**
32   * Describe the plain text uniform data struct.
33   *
34   * @interface PlainText
35   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
36   * @since 12
37   */
38  interface PlainText {
39    /**
40     * Indicates the uniform data type of this data struct.
41     *
42     * @type { 'general.plain-text' }
43     * @readonly
44     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
45     * @since 12
46     */
47    readonly uniformDataType: 'general.plain-text';
48    /**
49     * Indicates the content of the PlainText.
50     *
51     * @type { string }
52     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
53     * @since 12
54     */
55    textContent: string;
56
57    /**
58     * Indicates the abstract of the PlainText.
59     * @type { ?string }
60     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
61     * @since 12
62     */
63    abstract?: string;
64    /**
65     * Object of the dictionary type used to describe the attributes of the text content. Both the key and value of the
66     * object are of the string type. For example, the following is a details object used to describe the properties of
67     * a file:
68     * {
69     * "title":"Title of the file",
70     * "content":"Content of the file"
71     * }
72     * By default, it is an empty dictionary object.
73     *
74     * @type { ?Record<string, string> }
75     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
76     * @since 12
77     */
78     details?: Record<string, string>;
79  }
80
81  /**
82   * Describe the hyperlink uniform data struct.
83   *
84   * @interface Hyperlink
85   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
86   * @since 12
87   */
88  interface Hyperlink {
89    /**
90     * Indicates the uniform data type of this data struct.
91     *
92     * @type { 'general.hyperlink' }
93     * @readonly
94     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
95     * @since 12
96     */
97    readonly uniformDataType: 'general.hyperlink';
98    /**
99     * Indicates the url of of the Hyperlink.
100     *
101     * @type { string }
102     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
103     * @since 12
104     */
105    url: string;
106    /**
107     * Indicates the description of the Hyperlink.
108     * @type { ?string }
109     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
110     * @since 12
111     */
112    description?: string;
113    /**
114     * Object of the dictionary type used to describe the attributes of the hyperlink. Both the key and value of the
115     * object are of the string type. For example, the following is a details object used to describe the properties of
116     * a file:
117     * {
118     * "title":"Title of the hyperlink",
119     * "content":"Content"
120     * }
121     * By default, it is an empty dictionary object.
122     *
123     * @type { ?Record<string, string> }
124     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
125     * @since 12
126     */
127     details?: Record<string, string>;
128  }
129
130  /**
131   * Describe the html uniform data struct.
132   *
133   * @interface HTML
134   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
135   * @since 12
136   */
137  interface HTML {
138    /**
139     * Indicates the uniform data type of this data struct.
140     *
141     * @type { 'general.html' }
142     * @readonly
143     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
144     * @since 12
145     */
146    readonly uniformDataType: 'general.html';
147
148    /**
149     * Indicates the content of html, with html tags.
150     *
151     * @type { string }
152     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
153     * @since 12
154     */
155    htmlContent: string;
156    /**
157     * Indicates the plain content of html.
158     *
159     * @type { ?string }
160     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
161     * @since 12
162     */
163    plainContent?: string;
164    /**
165     * Object of the dictionary type used to describe the attributes of the HTML content. Both the key and value of the
166     * object are of the string type. For example, the following is a details object used to describe the properties of
167     * a file:
168     * {
169     * "title":"Title of the HTML content",
170     * "content":"Content"
171     * }
172     * By default, it is an empty dictionary object.
173     *
174     * @type { ?Record<string, string> }
175     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
176     * @since 12
177     */
178     details?: Record<string, string>;
179  }
180
181  /**
182   * Describe system defined app item uniform data struct(this kind of struct is provided and bound to OpenHarmony).
183   *
184   * @interface OpenHarmonyAppItem
185   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
186   * @since 12
187   */
188  interface OpenHarmonyAppItem {
189    /**
190     * Uniform data type, which has a fixed value of openharmony.app-item. For details, see UniformDataType.
191     *
192     * @type { 'openharmony.app-item' }
193     * @readonly
194     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
195     * @since 12
196     */
197    readonly uniformDataType: 'openharmony.app-item';
198    /**
199     * Indicates the app id.
200     *
201     * @type { string }
202     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
203     * @since 12
204     */
205    appId: string;
206    /**
207     * Indicates the app name.
208     *
209     * @type { string }
210     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
211     * @since 12
212     */
213    appName: string;
214    /**
215     * Indicates the id of app icon.
216     *
217     * @type { string }
218     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
219     * @since 12
220     */
221    appIconId: string;
222    /**
223     * Indicates the id of app label.
224     *
225     * @type { string }
226     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
227     * @since 12
228     */
229    appLabelId: string;
230    /**
231     * Indicates the bundle name of app.
232     *
233     * @type { string }
234     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
235     * @since 12
236     */
237    bundleName: string;
238    /**
239     * Indicates the ability name of app.
240     *
241     * @type { string }
242     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
243     * @since 12
244     */
245    abilityName: string;
246    /**
247     * Object of the dictionary type used to describe the icon. The key is of the string type, and the value can be a
248     * number, a string, or a Uint8Array. By default, it is an empty dictionary object.
249     *
250     * @type { ?Record<string, number | string | Uint8Array> }
251     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
252     * @since 12
253     */
254    details?: Record<string, number | string | Uint8Array>;
255  }
256
257  /**
258   * Uniform data type, which has a fixed value of general.content-form.
259   *
260   * @interface ContentForm
261   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
262   * @since 14
263   */
264  interface ContentForm {
265    /**
266     * Indicates the uniform data type of this data struct.
267     *
268     * @type { 'general.content-form' }
269     * @readonly
270     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
271     * @since 14
272     */
273    readonly uniformDataType: 'general.content-form';
274
275    /**
276     * Indicates the thumb data of content form.
277     *
278     * @type { Uint8Array }
279     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
280     * @since 14
281     */
282    thumbData?: Uint8Array;
283
284    /**
285     * Indicates the description of content form.
286     *
287     * @type { string }
288     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
289     * @since 14
290     */
291    description?: string;
292
293    /**
294     * Indicates the title of content form.
295     *
296     * @type { string }
297     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
298     * @since 14
299     */
300    title: string;
301
302    /**
303     * Indicates the app icon of content form.
304     *
305     * @type { Uint8Array }
306     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
307     * @since 14
308     */
309    appIcon?: Uint8Array;
310
311    /**
312     * Indicates the app name of content form.
313     *
314     * @type { appName }
315     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
316     * @since 14
317     */
318    appName?: string;
319
320    /**
321     * Indicates the link url of content form.
322     *
323     * @type { linkUri }
324     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
325     * @since 14
326     */
327    linkUri?: string;
328  }
329
330  /**
331   * Describe form uniform data struct.
332   *
333   * @interface Form
334   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
335   * @since 15
336   */
337  interface Form {
338    /**
339     * Uniform data type, which has a fixed value of openharmony.form. For details, see UniformDataType.
340     *
341     * @type { 'openharmony.form' }
342     * @readonly
343     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
344     * @since 15
345     */
346    readonly uniformDataType: 'openharmony.form';
347
348    /**
349     * Indicates the form id of form.
350     *
351     * @type { number }
352     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
353     * @since 15
354     */
355    formId: number;
356
357    /**
358     * Indicates the form name of form.
359     *
360     * @type { string }
361     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
362     * @since 15
363     */
364    formName: string;
365
366    /**
367     * Indicates the bundle name of form.
368     *
369     * @type { string }
370     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
371     * @since 15
372     */
373    bundleName: string;
374
375    /**
376     * Indicates the ability name of form.
377     *
378     * @type { string }
379     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
380     * @since 15
381     */
382    abilityName: string;
383
384    /**
385     * Indicates the module of form.
386     *
387     * @type { string }
388     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
389     * @since 15
390     */
391    module: string;
392
393    /**
394     * Indicates the details of form.
395     *
396     * @type { ?Record<string, number | string | Uint8Array> }
397     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
398     * @since 15
399     */
400    details?: Record<string, number | string | Uint8Array>;
401  }
402
403  /**
404   * Describe the file uri uniform data struct.
405   *
406   * @interface FileUri
407   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
408   * @since 15
409   */
410  interface FileUri {
411    /**
412     * Uniform data type, which has a fixed value of general.file-uri. For details, see UniformDataType.
413     *
414     * @type { 'general.file-uri' }
415     * @readonly
416     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
417     * @since 15
418     */
419    readonly uniformDataType: 'general.file-uri';
420
421    /**
422     * Indicates the oriUri of fileUri.
423     *
424     * @type { string }
425     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
426     * @since 15
427     */
428    oriUri: string;
429
430    /**
431     * Indicates the file type of fileUri.
432     *
433     * @type { string }
434     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
435     * @since 15
436     */
437    fileType: string;
438
439    /**
440     * Indicates the details of fileUri.
441     *
442     * @type { ?Record<string, number | string | Uint8Array> }
443     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
444     * @since 15
445     */
446    details?: Record<string, number | string | Uint8Array>;
447  }
448
449  /**
450   * Describe the pixelMap uniform data struct.
451   *
452   * @interface PixelMap
453   * @syscap SystemCapability.DistributedDataManager.UDMF.Core
454   * @since 15
455   */
456  interface PixelMap {
457    /**
458     * 	Uniform data type, which has a fixed value of openharmony.pixel-map. For details, see UniformDataType.
459     *
460     * @type { 'openharmony.pixel-map' }
461     * @readonly
462     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
463     * @since 15
464     */
465    readonly uniformDataType: 'openharmony.pixel-map';
466
467    /**
468     * Indicates the pixelMap value of pixelMap.
469     *
470     * @type { image.PixelMap }
471     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
472     * @since 15
473     */
474    pixelMap: image.PixelMap;
475
476    /**
477     * Indicates the details of pixelMap.
478     *
479     * @type { ?Record<string, number | string | Uint8Array> }
480     * @syscap SystemCapability.DistributedDataManager.UDMF.Core
481     * @since 15
482     */
483    details?: Record<string, number | string | Uint8Array>;
484  }
485}
486
487export default uniformDataStruct;