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