• 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 * @file
18 * @kit BasicServicesKit
19 */
20
21import { AsyncCallback } from './@ohos.base';
22import Want from './@ohos.app.ability.Want';
23import image from './@ohos.multimedia.image';
24import unifiedDataChannel from './@ohos.data.unifiedDataChannel';
25
26/**
27 * systemPasteboard
28 * @namespace pasteboard
29 * @syscap SystemCapability.MiscServices.Pasteboard
30 * @since 6
31 */
32/**
33 * systemPasteboard
34 * @namespace pasteboard
35 * @syscap SystemCapability.MiscServices.Pasteboard
36 * @atomicservice
37 * @since 11
38 */
39declare namespace pasteboard {
40  /**
41   * Indicates the maximum number of records allowed in a PasteData object.
42   * @constant
43   * @syscap SystemCapability.MiscServices.Pasteboard
44   * @since 7
45   */
46  /**
47   * Indicates the maximum number of records allowed in a PasteData object.
48   * @constant
49   * @syscap SystemCapability.MiscServices.Pasteboard
50   * @atomicservice
51   * @since 11
52   */
53  const MAX_RECORD_NUM = 512;
54  /**
55   * Indicates MIME types of HTML text.
56   * @constant
57   * @syscap SystemCapability.MiscServices.Pasteboard
58   * @since 7
59   */
60  /**
61   * Indicates MIME types of HTML text.
62   * @constant
63   * @syscap SystemCapability.MiscServices.Pasteboard
64   * @atomicservice
65   * @since 11
66   */
67  const MIMETYPE_TEXT_HTML = 'text/html';
68  /**
69   * Indicates MIME types of wants.
70   * @constant
71   * @syscap SystemCapability.MiscServices.Pasteboard
72   * @since 7
73   */
74  /**
75   * Indicates MIME types of wants.
76   * @constant
77   * @syscap SystemCapability.MiscServices.Pasteboard
78   * @atomicservice
79   * @since 11
80   */
81  const MIMETYPE_TEXT_WANT = 'text/want';
82  /**
83   * Indicates MIME types of plain text.
84   * @constant
85   * @syscap SystemCapability.MiscServices.Pasteboard
86   * @since 7
87   */
88  /**
89   * Indicates MIME types of plain text.
90   * @constant
91   * @syscap SystemCapability.MiscServices.Pasteboard
92   * @atomicservice
93   * @since 11
94   */
95  const MIMETYPE_TEXT_PLAIN = 'text/plain';
96  /**
97   * Indicates MIME types of URIs.
98   * @constant
99   * @syscap SystemCapability.MiscServices.Pasteboard
100   * @since 7
101   */
102  /**
103   * Indicates MIME types of URIs.
104   * @constant
105   * @syscap SystemCapability.MiscServices.Pasteboard
106   * @atomicservice
107   * @since 11
108   */
109  const MIMETYPE_TEXT_URI = 'text/uri';
110  /**
111   * Indicates MIME type of PixelMap.
112   * @constant
113   * @syscap SystemCapability.MiscServices.Pasteboard
114   * @since 9
115   */
116  /**
117   * Indicates MIME type of PixelMap.
118   * @constant
119   * @syscap SystemCapability.MiscServices.Pasteboard
120   * @atomicservice
121   * @since 11
122   */
123  const MIMETYPE_PIXELMAP = 'pixelMap';
124
125  /**
126   * Indicates type of value.
127   * @type { string | image.PixelMap | Want | ArrayBuffer }
128   * @syscap SystemCapability.MiscServices.Pasteboard
129   * @since 9
130   */
131  /**
132   * Indicates type of value.
133   * @typedef { string | image.PixelMap | Want | ArrayBuffer }
134   * @syscap SystemCapability.MiscServices.Pasteboard
135   * @atomicservice
136   * @since 11
137   */
138  type ValueType = string | image.PixelMap | Want | ArrayBuffer;
139
140  /**
141   * Creates a PasteData object for PasteData#MIMETYPE_TEXT_HTML.
142   * @param { string } htmlText - To save the Html text content.
143   * @returns { PasteData } Containing the contents of the clipboard content object.
144   * @syscap SystemCapability.MiscServices.Pasteboard
145   * @since 7
146   * @deprecated since 9
147   * @useinstead ohos.pasteboard.pasteboard#createData
148   */
149  function createHtmlData(htmlText: string): PasteData;
150
151  /**
152   * Creates a PasteData object for PasteData#MIMETYPE_TEXT_WANT.
153   * @param { Want } want - To save the want of content.
154   * @returns { PasteData } Containing the contents of the clipboard content object.
155   * @syscap SystemCapability.MiscServices.Pasteboard
156   * @since 7
157   * @deprecated since 9
158   * @useinstead ohos.pasteboard.pasteboard#createData
159   */
160  function createWantData(want: Want): PasteData;
161
162  /**
163   * Creates a PasteData object for PasteData#MIMETYPE_TEXT_PLAIN.
164   * @param { string } text - To save the text of content.
165   * @returns { PasteData } Containing the contents of the clipboard content object.
166   * @syscap SystemCapability.MiscServices.Pasteboard
167   * @since 6
168   * @deprecated since 9
169   * @useinstead ohos.pasteboard.pasteboard#createData
170   */
171  function createPlainTextData(text: string): PasteData;
172
173  /**
174   * Creates a PasteData object for PasteData#MIMETYPE_TEXT_URI.
175   * @param { string } uri - To save the uri of content.
176   * @returns { PasteData } Containing the contents of the clipboard content object.
177   * @syscap SystemCapability.MiscServices.Pasteboard
178   * @since 7
179   * @deprecated since 9
180   * @useinstead ohos.pasteboard.pasteboard#createData
181   */
182  function createUriData(uri: string): PasteData;
183
184  /**
185   * Creates a PasteData object with MIME type and value.
186   * @param { string } mimeType - indicates MIME type of value, its size cannot be greater than 1024 bytes.
187   * @param { ValueType } value - indicates the content that is set to PasteData.
188   * @returns { PasteData } a new PasteData object which contains mimeType and value.
189   * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
190   *    2. Incorrect parameters types;
191   *    3. Parameter verification failed.
192   * @syscap SystemCapability.MiscServices.Pasteboard
193   * @since 9
194   */
195  /**
196   * Creates a PasteData object with MIME type and value.
197   * @param { string } mimeType - indicates MIME type of value, its size cannot be greater than 1024 bytes.
198   * @param { ValueType } value - indicates the content that is set to PasteData.
199   * @returns { PasteData } a new PasteData object which contains mimeType and value.
200   * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
201   *    2. Incorrect parameters types;
202   *    3. Parameter verification failed.
203   * @syscap SystemCapability.MiscServices.Pasteboard
204   * @atomicservice
205   * @since 11
206   */
207  function createData(mimeType: string, value: ValueType): PasteData;
208
209  /**
210   * Creates a PasteData object with the specified MIME types and values.
211   * @param { Record<string, ValueType> } data - indicates the MEME types and values of the PasteData object to create.
212   * @returns { PasteData } Returns the PasteData object created.
213   * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
214   *    2. Incorrect parameters types;
215   *    3. Parameter verification failed.
216   * @syscap SystemCapability.MiscServices.Pasteboard
217   * @since 14
218   */
219  function createData(data: Record<string, ValueType>): PasteData;
220
221  /**
222   * Creates a Record object for PasteData#MIMETYPE_TEXT_HTML.
223   * @param { string } htmlText - To save the Html text content.
224   * @returns { PasteDataRecord } The content of a new record
225   * @syscap SystemCapability.MiscServices.Pasteboard
226   * @since 7
227   * @deprecated since 9
228   * @useinstead ohos.pasteboard.pasteboard#createRecord
229   */
230  function createHtmlTextRecord(htmlText: string): PasteDataRecord;
231
232  /**
233   * Creates a Record object for PasteData#MIMETYPE_TEXT_WANT.
234   * @param { Want } want - To save the want of content.
235   * @returns { PasteDataRecord } The content of a new record
236   * @syscap SystemCapability.MiscServices.Pasteboard
237   * @since 7
238   * @deprecated since 9
239   * @useinstead ohos.pasteboard.pasteboard#createRecord
240   */
241  function createWantRecord(want: Want): PasteDataRecord;
242
243  /**
244   * Creates a Record object for PasteData#MIMETYPE_TEXT_PLAIN.
245   * @param { string } text - To save the text of content.
246   * @returns { PasteDataRecord } The content of a new record
247   * @syscap SystemCapability.MiscServices.Pasteboard
248   * @since 7
249   * @deprecated since 9
250   * @useinstead ohos.pasteboard.pasteboard#createRecord
251   */
252  function createPlainTextRecord(text: string): PasteDataRecord;
253
254  /**
255   * Creates a Record object for PasteData#MIMETYPE_TEXT_URI.
256   * @param { string } uri - To save the uri of content.
257   * @returns { PasteDataRecord } The content of a new record
258   * @syscap SystemCapability.MiscServices.Pasteboard
259   * @since 7
260   * @deprecated since 9
261   * @useinstead ohos.pasteboard.pasteboard#createRecord
262   */
263  function createUriRecord(uri: string): PasteDataRecord;
264
265  /**
266   * Creates a record object with MIME type and value.
267   * @param { string } mimeType - indicates MIME type of value, its size cannot be greater than 1024 bytes.
268   * @param { ValueType } value - content to be saved.
269   * @returns { PasteDataRecord } a new PasteDataRecord object which contains mimeType and value.
270   * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
271   *    2. Incorrect parameters types;
272   *    3. Parameter verification failed.
273   * @syscap SystemCapability.MiscServices.Pasteboard
274   * @since 9
275   */
276  /**
277   * Creates a record object with MIME type and value.
278   * @param { string } mimeType - indicates MIME type of value, its size cannot be greater than 1024 bytes.
279   * @param { ValueType } value - content to be saved.
280   * @returns { PasteDataRecord } a new PasteDataRecord object which contains mimeType and value.
281   * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
282   *    2. Incorrect parameters types;
283   *    3. Parameter verification failed.
284   * @syscap SystemCapability.MiscServices.Pasteboard
285   * @atomicservice
286   * @since 11
287   */
288  function createRecord(mimeType: string, value: ValueType): PasteDataRecord;
289
290  /**
291   * get SystemPasteboard
292   * @returns { SystemPasteboard } The system clipboard object
293   * @syscap SystemCapability.MiscServices.Pasteboard
294   * @since 6
295   */
296  /**
297   * get SystemPasteboard
298   * @returns { SystemPasteboard } The system clipboard object
299   * @syscap SystemCapability.MiscServices.Pasteboard
300   * @atomicservice
301   * @since 11
302   */
303  function getSystemPasteboard(): SystemPasteboard;
304
305  /**
306   * Types of scope that PasteData can be pasted.
307   * @enum { number }
308   * @syscap SystemCapability.MiscServices.Pasteboard
309   * @since 9
310   */
311  /**
312   * Types of scope that PasteData can be pasted.
313   * @enum { number }
314   * @syscap SystemCapability.MiscServices.Pasteboard
315   * @atomicservice
316   * @since 11
317   */
318  enum ShareOption {
319    /**
320     * INAPP indicates that only paste in the same app is allowed.
321     * @syscap SystemCapability.MiscServices.Pasteboard
322     * @since 9
323     */
324    /**
325     * INAPP indicates that only paste in the same app is allowed.
326     * @syscap SystemCapability.MiscServices.Pasteboard
327     * @atomicservice
328     * @since 11
329     */
330    INAPP,
331    /**
332     * LOCALDEVICE indicates that paste in any app in this device is allowed.
333     * @syscap SystemCapability.MiscServices.Pasteboard
334     * @since 9
335     */
336    /**
337     * LOCALDEVICE indicates that paste in any app in this device is allowed.
338     * @syscap SystemCapability.MiscServices.Pasteboard
339     * @atomicservice
340     * @since 11
341     */
342    LOCALDEVICE,
343    /**
344     * CROSSDEVICE indicates that paste in any app across devices is allowed.
345     * @syscap SystemCapability.MiscServices.Pasteboard
346     * @since 9
347     */
348    /**
349     * CROSSDEVICE indicates that paste in any app across devices is allowed.
350     * @syscap SystemCapability.MiscServices.Pasteboard
351     * @atomicservice
352     * @since 11
353     * @deprecated since 12
354     */
355    CROSSDEVICE
356  }
357
358  /**
359   * Enumerates the patterns allowed in the system pasteboard.
360   * @enum { number }
361   * @syscap SystemCapability.MiscServices.Pasteboard
362   * @since 13
363   */
364  enum Pattern {
365    /**
366     * URL pattern.
367     * @syscap SystemCapability.MiscServices.Pasteboard
368     * @since 13
369     */
370    URL = 0,
371    /**
372     * Number pattern.
373     * @syscap SystemCapability.MiscServices.Pasteboard
374     * @since 13
375     */
376    NUMBER = 1,
377    /**
378     * Email address pattern.
379     * @syscap SystemCapability.MiscServices.Pasteboard
380     * @since 13
381     */
382    EMAIL_ADDRESS = 2,
383  }
384
385
386  /**
387   * Paste data property.
388   * @interface PasteDataProperty
389   * @syscap SystemCapability.MiscServices.Pasteboard
390   * @since 7
391   */
392  /**
393   * Paste data property.
394   * @interface PasteDataProperty
395   * @syscap SystemCapability.MiscServices.Pasteboard
396   * @atomicservice
397   * @since 11
398   */
399  interface PasteDataProperty {
400    /**
401     * additional property data. key-value pairs.
402     * @type { object }
403     * @syscap SystemCapability.MiscServices.Pasteboard
404     * @since 7
405     */
406    /**
407     * additional property data. key-value pairs.
408     * @type { object }
409     * @syscap SystemCapability.MiscServices.Pasteboard
410     * @atomicservice
411     * @since 11
412     */
413    additions: {
414      [key: string]: object
415    }
416    /**
417     * non-repeating MIME types of all records in PasteData.
418     * @type { Array<string> }
419     * @readonly
420     * @syscap SystemCapability.MiscServices.Pasteboard
421     * @since 7
422     */
423    /**
424     * non-repeating MIME types of all records in PasteData.
425     * @type { Array<string> }
426     * @readonly
427     * @syscap SystemCapability.MiscServices.Pasteboard
428     * @atomicservice
429     * @since 11
430     */
431    readonly mimeTypes: Array<string>;
432    /**
433     * the user-defined tag of a PasteData object.
434     * @type { string }
435     * @syscap SystemCapability.MiscServices.Pasteboard
436     * @since 7
437     */
438    /**
439     * the user-defined tag of a PasteData object.
440     * @type { string }
441     * @syscap SystemCapability.MiscServices.Pasteboard
442     * @atomicservice
443     * @since 11
444     */
445    tag: string;
446    /**
447     * a timestamp, which indicates when data is written to the system pasteboard.
448     * @type { number }
449     * @readonly
450     * @syscap SystemCapability.MiscServices.Pasteboard
451     * @since 7
452     */
453    /**
454     * a timestamp, which indicates when data is written to the system pasteboard.
455     * @type { number }
456     * @readonly
457     * @syscap SystemCapability.MiscServices.Pasteboard
458     * @atomicservice
459     * @since 11
460     */
461    readonly timestamp: number;
462    /**
463     * Checks whether PasteData is set for local access only.
464     * @type { boolean }
465     * @syscap SystemCapability.MiscServices.Pasteboard
466     * @since 7
467     */
468    /**
469     * Checks whether PasteData is set for local access only.
470     * @type { boolean }
471     * @syscap SystemCapability.MiscServices.Pasteboard
472     * @atomicservice
473     * @since 11
474     */
475    localOnly: boolean;
476    /**
477     * Indicates the scope of clipboard data which can be pasted.
478     * If it is not set or is incorrectly set, The default value is CrossDevice.
479     * @type { ShareOption }
480     * @syscap SystemCapability.MiscServices.Pasteboard
481     * @since 9
482     */
483    /**
484     * Indicates the scope of clipboard data which can be pasted.
485     * If it is not set or is incorrectly set, The default value is CrossDevice.
486     * @type { ShareOption }
487     * @syscap SystemCapability.MiscServices.Pasteboard
488     * @atomicservice
489     * @since 11
490     */
491    shareOption: ShareOption;
492  }
493
494  /**
495   * Paste data record.
496   * @interface PasteDataRecord
497   * @syscap SystemCapability.MiscServices.Pasteboard
498   * @since 7
499   */
500  /**
501   * Paste data record.
502   * @interface PasteDataRecord
503   * @syscap SystemCapability.MiscServices.Pasteboard
504   * @atomicservice
505   * @since 11
506   */
507  interface PasteDataRecord {
508    /**
509     * HTML text in a record.
510     * @type { string }
511     * @syscap SystemCapability.MiscServices.Pasteboard
512     * @since 7
513     */
514    /**
515     * HTML text in a record.
516     * @type { string }
517     * @syscap SystemCapability.MiscServices.Pasteboard
518     * @atomicservice
519     * @since 11
520     */
521    htmlText: string;
522    /**
523     * an want in a record.
524     * @type { Want }
525     * @syscap SystemCapability.MiscServices.Pasteboard
526     * @since 7
527     */
528    /**
529     * an want in a record.
530     * @type { Want }
531     * @syscap SystemCapability.MiscServices.Pasteboard
532     * @atomicservice
533     * @since 11
534     */
535    want: Want;
536    /**
537     * MIME types of a record.
538     * @type { string }
539     * @syscap SystemCapability.MiscServices.Pasteboard
540     * @since 7
541     */
542    /**
543     * MIME types of a record.
544     * @type { string }
545     * @syscap SystemCapability.MiscServices.Pasteboard
546     * @atomicservice
547     * @since 11
548     */
549    mimeType: string;
550    /**
551     * plain text in a record.
552     * @type { string }
553     * @syscap SystemCapability.MiscServices.Pasteboard
554     * @since 7
555     */
556    /**
557     * plain text in a record.
558     * @type { string }
559     * @syscap SystemCapability.MiscServices.Pasteboard
560     * @atomicservice
561     * @since 11
562     */
563    plainText: string;
564    /**
565     * an URI in a record.
566     * @type { string }
567     * @syscap SystemCapability.MiscServices.Pasteboard
568     * @since 7
569     */
570    /**
571     * an URI in a record.
572     * @type { string }
573     * @syscap SystemCapability.MiscServices.Pasteboard
574     * @atomicservice
575     * @since 11
576     */
577    uri: string;
578    /**
579     * PixelMap in a record.
580     * @type { image.PixelMap }
581     * @syscap SystemCapability.MiscServices.Pasteboard
582     * @since 9
583     */
584    /**
585     * PixelMap in a record.
586     * @type { image.PixelMap }
587     * @syscap SystemCapability.MiscServices.Pasteboard
588     * @atomicservice
589     * @since 11
590     */
591    pixelMap: image.PixelMap;
592    /**
593     * Custom data in a record, mimeType indicates the MIME type of custom data, ArrayBuffer indicates the value of custom data.
594     * @type { object }
595     * @syscap SystemCapability.MiscServices.Pasteboard
596     * @since 9
597     */
598    /**
599     * Custom data in a record, mimeType indicates the MIME type of custom data, ArrayBuffer indicates the value of custom data.
600     * @type { object }
601     * @syscap SystemCapability.MiscServices.Pasteboard
602     * @atomicservice
603     * @since 11
604     */
605    data: {
606      [mimeType: string]: ArrayBuffer
607    }
608
609    /**
610     * Converts data in PasteData to text format.
611     * @param { AsyncCallback<string> } callback - the callback of convertToText.
612     * @throws { BusinessError } 401 - Possible causes: Incorrect parameters types.
613     * @syscap SystemCapability.MiscServices.Pasteboard
614     * @since 7
615     * @deprecated since 9
616     * @useinstead ohos.pasteboard.pasteboard#convertToTextV9
617     */
618    convertToText(callback: AsyncCallback<string>): void;
619
620    /**
621     * Converts data in PasteData to text format.
622     * @returns { Promise<string> } the promise returned by the function.
623     * @syscap SystemCapability.MiscServices.Pasteboard
624     * @since 7
625     * @deprecated since 9
626     * @useinstead ohos.pasteboard.pasteboard#convertToTextV9
627     */
628    convertToText(): Promise<string>;
629
630    /**
631     * Converts data in PasteData to text format.
632     * @returns { string } the string returned by the function.
633     * @syscap SystemCapability.MiscServices.Pasteboard
634     * @since 9
635     */
636    /**
637     * Converts data in PasteData to text format.
638     * @returns { string } the string returned by the function.
639     * @syscap SystemCapability.MiscServices.Pasteboard
640     * @atomicservice
641     * @since 11
642     */
643    toPlainText(): string;
644
645    /**
646     * Adds data to the PasteDataRecord object.
647     * @param { string } type - indicates MIME type of the value to add. It cannot exceed 1024 bytes.
648     * @param { ValueType } value - indicates the value of the data to add.
649     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
650     *    2. Incorrect parameters types;
651     *    3. Parameter verification failed.
652     * @syscap SystemCapability.MiscServices.Pasteboard
653     * @since 14
654     */
655    addEntry(type: string, value: ValueType): void;
656
657    /**
658     * Obtains the valid types in the PasteDataRecord object.
659     * @param { Array<string> } types - indicates an array of types from which the valid types are obtained.
660     * @returns { Array<string> } Returns the valid types obtained.
661     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
662     *    2. Incorrect parameters types;
663     *    3. Parameter verification failed.
664     * @syscap SystemCapability.MiscServices.Pasteboard
665     * @since 14
666     */
667    getValidTypes(types: Array<string>): Array<string>;
668
669    /**
670     * Obtains data of the specified type.
671     * @param { string } type - indicates the type of the data to obtain.
672     * @returns { Promise<ValueType> } Promise used to return the data obtained.
673     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
674     *    2. Incorrect parameters types;
675     *    3. Parameter verification failed.
676     * @syscap SystemCapability.MiscServices.Pasteboard
677     * @since 14
678     */
679    getData(type: string): Promise<ValueType>;
680  }
681
682  /**
683   * Classes for paste data.
684   * @interface PasteData
685   * @syscap SystemCapability.MiscServices.Pasteboard
686   * @since 6
687   */
688  /**
689   * Classes for paste data.
690   * @interface PasteData
691   * @syscap SystemCapability.MiscServices.Pasteboard
692   * @atomicservice
693   * @since 11
694   */
695  interface PasteData {
696    /**
697     * Adds a Record for HTML text to a PasteData object, and updates the MIME type to PasteData#MIMETYPE_TEXT_HTML in DataProperty.
698     * @param { string } htmlText - To save the Html text content.
699     * @syscap SystemCapability.MiscServices.Pasteboard
700     * @since 7
701     * @deprecated since 9
702     * @useinstead ohos.pasteboard.pasteboard#addRecord
703     */
704    addHtmlRecord(htmlText: string): void;
705
706    /**
707     * Adds an want Record to a PasteData object, and updates the MIME type to PasteData#MIMETYPE_TEXT_WANT in DataProperty.
708     * @param { Want } want - To save the want content.
709     * @syscap SystemCapability.MiscServices.Pasteboard
710     * @since 7
711     * @deprecated since 9
712     * @useinstead ohos.pasteboard.pasteboard#addRecord
713     */
714    addWantRecord(want: Want): void;
715
716    /**
717     * Adds a PasteRecord to a PasteData object and updates MIME types in DataProperty.
718     * @param { PasteDataRecord } record - The content of a new record.
719     * @syscap SystemCapability.MiscServices.Pasteboard
720     * @since 7
721     */
722    /**
723     * Adds a PasteRecord to a PasteData object and updates MIME types in DataProperty.
724     * @param { PasteDataRecord } record - The content of a new record.
725     * @syscap SystemCapability.MiscServices.Pasteboard
726     * @atomicservice
727     * @since 11
728     */
729    addRecord(record: PasteDataRecord): void;
730
731    /**
732     * Adds a Record for plain text to a PasteData object, and updates the MIME type to PasteData#MIMETYPE_TEXT_PLAIN in DataProperty.
733     * @param { string } text - To save the text of content.
734     * @syscap SystemCapability.MiscServices.Pasteboard
735     * @since 7
736     * @deprecated since 9
737     * @useinstead ohos.pasteboard.pasteboard#addRecord
738     */
739    addTextRecord(text: string): void;
740
741    /**
742     * Adds a URI Record to a PasteData object, and updates the MIME type to PasteData#MIMETYPE_TEXT_URI in DataProperty.
743     * @param { string } uri - To save the uri of content.
744     * @syscap SystemCapability.MiscServices.Pasteboard
745     * @since 7
746     * @deprecated since 9
747     * @useinstead ohos.pasteboard.pasteboard#addRecord
748     */
749    addUriRecord(uri: string): void;
750
751    /**
752     * Adds a record with mimeType and value to a PasteData object.
753     * @param { string } mimeType - indicates the MIME type of value, its size cannot be greater than 1024 bytes.
754     * @param { ValueType } value - content to be saved.
755     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
756     *    2. Incorrect parameters types;
757     *    3. Parameter verification failed.
758     * @throws { BusinessError } 12900002 - The number of records exceeds the upper limit.
759     * @syscap SystemCapability.MiscServices.Pasteboard
760     * @since 9
761     */
762    /**
763     * Adds a record with mimeType and value to a PasteData object.
764     * @param { string } mimeType - indicates the MIME type of value, its size cannot be greater than 1024 bytes.
765     * @param { ValueType } value - content to be saved.
766     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
767     *    2. Incorrect parameters types;
768     *    3. Parameter verification failed.
769     * @syscap SystemCapability.MiscServices.Pasteboard
770     * @since 10
771     */
772    /**
773     * Adds a record with mimeType and value to a PasteData object.
774     * @param { string } mimeType - indicates the MIME type of value, its size cannot be greater than 1024 bytes.
775     * @param { ValueType } value - content to be saved.
776     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
777     *    2. Incorrect parameters types;
778     *    3. Parameter verification failed.
779     * @syscap SystemCapability.MiscServices.Pasteboard
780     * @atomicservice
781     * @since 11
782     */
783    addRecord(mimeType: string, value: ValueType): void;
784
785    /**
786     * MIME types of all content on the pasteboard.
787     * @returns { Array<string> } type of array
788     * @syscap SystemCapability.MiscServices.Pasteboard
789     * @since 7
790     */
791    /**
792     * MIME types of all content on the pasteboard.
793     * @returns { Array<string> } type of array
794     * @syscap SystemCapability.MiscServices.Pasteboard
795     * @atomicservice
796     * @since 11
797     */
798    getMimeTypes(): Array<string>;
799
800    /**
801     * HTML text of the primary record in a PasteData object.
802     * @returns { string } type of htmltext
803     * @syscap SystemCapability.MiscServices.Pasteboard
804     * @since 7
805     */
806    /**
807     * HTML text of the primary record in a PasteData object.
808     * @returns { string } type of htmltext
809     * @syscap SystemCapability.MiscServices.Pasteboard
810     * @atomicservice
811     * @since 11
812     */
813    getPrimaryHtml(): string;
814
815    /**
816     * the want of the primary record in a PasteData object.
817     * @returns { Want } type of want
818     * @syscap SystemCapability.MiscServices.Pasteboard
819     * @since 7
820     */
821    /**
822     * the want of the primary record in a PasteData object.
823     * @returns { Want } type of want
824     * @syscap SystemCapability.MiscServices.Pasteboard
825     * @atomicservice
826     * @since 11
827     */
828    getPrimaryWant(): Want;
829
830    /**
831     * the MIME type of the primary record in a PasteData object.
832     * @returns { string } type of mimetype
833     * @syscap SystemCapability.MiscServices.Pasteboard
834     * @since 7
835     */
836    /**
837     * the MIME type of the primary record in a PasteData object.
838     * @returns { string } type of mimetype
839     * @syscap SystemCapability.MiscServices.Pasteboard
840     * @atomicservice
841     * @since 11
842     */
843    getPrimaryMimeType(): string;
844
845    /**
846     * the plain text of the primary record in a PasteData object.
847     * @returns { string } type of text
848     * @syscap SystemCapability.MiscServices.Pasteboard
849     * @since 6
850     */
851    /**
852     * the plain text of the primary record in a PasteData object.
853     * @returns { string } type of text
854     * @syscap SystemCapability.MiscServices.Pasteboard
855     * @atomicservice
856     * @since 11
857     */
858    getPrimaryText(): string;
859
860    /**
861     * the URI of the primary record in a PasteData object.
862     * @returns { string } type of uri
863     * @syscap SystemCapability.MiscServices.Pasteboard
864     * @since 7
865     */
866    /**
867     * the URI of the primary record in a PasteData object.
868     * @returns { string } type of uri
869     * @syscap SystemCapability.MiscServices.Pasteboard
870     * @atomicservice
871     * @since 11
872     */
873    getPrimaryUri(): string;
874
875    /**
876     * Gets the primary PixelMap record in a PasteData object.
877     * @returns { image.PixelMap } pixelMap
878     * @syscap SystemCapability.MiscServices.Pasteboard
879     * @since 9
880     */
881    /**
882     * Gets the primary PixelMap record in a PasteData object.
883     * @returns { image.PixelMap } pixelMap
884     * @syscap SystemCapability.MiscServices.Pasteboard
885     * @atomicservice
886     * @since 11
887     */
888    getPrimaryPixelMap(): image.PixelMap;
889
890    /**
891     * DataProperty of a PasteData object.
892     * @returns { PasteDataProperty } PasteDataProperty type of PasteDataProperty
893     * @syscap SystemCapability.MiscServices.Pasteboard
894     * @since 7
895     */
896    /**
897     * DataProperty of a PasteData object.
898     * @returns { PasteDataProperty } PasteDataProperty type of PasteDataProperty
899     * @syscap SystemCapability.MiscServices.Pasteboard
900     * @atomicservice
901     * @since 11
902     */
903    getProperty(): PasteDataProperty;
904
905    /**
906     * Sets PasteDataProperty to a PasteData object, Modifying shareOption is supported only.
907     * @param { PasteDataProperty } property - save property to PasteData object.
908     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
909     *    2. Incorrect parameters types.
910     * @syscap SystemCapability.MiscServices.Pasteboard
911     * @since 9
912     */
913    /**
914     * Sets PasteDataProperty to a PasteData object, Modifying shareOption is supported only.
915     * @param { PasteDataProperty } property - save property to PasteData object.
916     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
917     *    2. Incorrect parameters types.
918     * @syscap SystemCapability.MiscServices.Pasteboard
919     * @atomicservice
920     * @since 11
921     */
922    setProperty(property: PasteDataProperty): void;
923
924    /**
925     * Gets record by index in PasteData.
926     * @param { number } index - indicates the record index in PasteData.
927     * @returns { PasteDataRecord } the record in PasteData with index.
928     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
929     *    2. Incorrect parameters types.
930     * @syscap SystemCapability.MiscServices.Pasteboard
931     * @since 7
932     * @deprecated since 9
933     * @useinstead ohos.pasteboard.pasteboard#getRecord
934     */
935    getRecordAt(index: number): PasteDataRecord;
936
937    /**
938     * Gets record by index in PasteData.
939     * @param { number } index - indicates the record index in PasteData.
940     * @returns { PasteDataRecord } the record in PasteData with index.
941     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
942     *    2. Incorrect parameters types.
943     * @throws { BusinessError } 12900001 - The index is out of the record.
944     * @syscap SystemCapability.MiscServices.Pasteboard
945     * @since 9
946     */
947    /**
948     * Gets record by index in PasteData.
949     * @param { number } index - indicates the record index in PasteData.
950     * @returns { PasteDataRecord } the record in PasteData with index.
951     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
952     *    2. Incorrect parameters types.
953     * @throws { BusinessError } 12900001 - The index is out of the record.
954     * @syscap SystemCapability.MiscServices.Pasteboard
955     * @atomicservice
956     * @since 11
957     */
958    getRecord(index: number): PasteDataRecord;
959
960    /**
961     * the number of records in a PasteData object.
962     * @returns { number } The number of the clipboard contents
963     * @syscap SystemCapability.MiscServices.Pasteboard
964     * @since 7
965     */
966    /**
967     * the number of records in a PasteData object.
968     * @returns { number } The number of the clipboard contents
969     * @syscap SystemCapability.MiscServices.Pasteboard
970     * @atomicservice
971     * @since 11
972     */
973    getRecordCount(): number;
974
975    /**
976     * the user-defined tag of a PasteData object.
977     * @returns { string } type of tag
978     * @syscap SystemCapability.MiscServices.Pasteboard
979     * @since 7
980     */
981    /**
982     * the user-defined tag of a PasteData object.
983     * @returns { string } type of tag
984     * @syscap SystemCapability.MiscServices.Pasteboard
985     * @atomicservice
986     * @since 11
987     */
988    getTag(): string;
989
990    /**
991     * Checks whether there is a specified MIME type of data in DataProperty.
992     * @param { string } mimeType - indicates to query data type.
993     * @returns { boolean } if having mimeType in PasteData returns true, else returns false.
994     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
995     *    2. Incorrect parameters types.
996     * @syscap SystemCapability.MiscServices.Pasteboard
997     * @since 7
998     * @deprecated since 9
999     * @useinstead ohos.pasteboard.pasteboard#hasType
1000     */
1001    hasMimeType(mimeType: string): boolean;
1002
1003    /**
1004     * Checks whether there is a specified MIME type of data in DataProperty.
1005     * @param { string } mimeType - indicates to query data type.
1006     * @returns { boolean } if having mimeType in PasteData returns true, else returns false.
1007     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
1008     *    2. Incorrect parameters types.
1009     * @syscap SystemCapability.MiscServices.Pasteboard
1010     * @since 9
1011     */
1012    /**
1013     * Checks whether there is a specified MIME type of data in DataProperty.
1014     * @param { string } mimeType - indicates to query data type.
1015     * @returns { boolean } if having mimeType in PasteData returns true, else returns false.
1016     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
1017     *    2. Incorrect parameters types.
1018     * @syscap SystemCapability.MiscServices.Pasteboard
1019     * @atomicservice
1020     * @since 11
1021     */
1022    hasType(mimeType: string): boolean;
1023
1024    /**
1025     * Removes a Record based on a specified index.
1026     * @param { number } index - indicates the record index in PasteData.
1027     * @returns { boolean } The query returns True on success, or False on failure.
1028     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
1029     *    2. Incorrect parameters types.
1030     * @syscap SystemCapability.MiscServices.Pasteboard
1031     * @since 7
1032     * @deprecated since 9
1033     * @useinstead ohos.pasteboard.pasteboard#removeRecord
1034     */
1035    removeRecordAt(index: number): boolean;
1036
1037    /**
1038     * Removes a Record based on a specified index.
1039     * @param { number } index - indicates the record index in PasteData.
1040     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
1041     *    2. Incorrect parameters types.
1042     * @throws { BusinessError } 12900001 - The index is out of the record.
1043     * @syscap SystemCapability.MiscServices.Pasteboard
1044     * @since 9
1045     */
1046    /**
1047     * Removes a Record based on a specified index.
1048     * @param { number } index - indicates the record index in PasteData.
1049     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
1050     *    2. Incorrect parameters types.
1051     * @throws { BusinessError } 12900001 - The index is out of the record.
1052     * @syscap SystemCapability.MiscServices.Pasteboard
1053     * @atomicservice
1054     * @since 11
1055     */
1056    removeRecord(index: number): void;
1057
1058    /**
1059     * Replaces a specified record with a new one.
1060     * @param { number } index - indicates the record index in PasteData.
1061     * @param { PasteDataRecord } record - the content of a new record.
1062     * @returns { boolean } The query returns True on success, or False on failure.
1063     * @syscap SystemCapability.MiscServices.Pasteboard
1064     * @since 7
1065     * @deprecated since 9
1066     * @useinstead ohos.pasteboard.pasteboard#replaceRecord
1067     */
1068    replaceRecordAt(index: number, record: PasteDataRecord): boolean;
1069
1070    /**
1071     * Replaces a specified record with a new one.
1072     * @param { number } index - indicates the record index in PasteData.
1073     * @param { PasteDataRecord } record - the content of a new record.
1074     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
1075     *    2. Incorrect parameters types.
1076     * @throws { BusinessError } 12900001 - The index is out of the record.
1077     * @syscap SystemCapability.MiscServices.Pasteboard
1078     * @since 9
1079     */
1080    /**
1081     * Replaces a specified record with a new one.
1082     * @param { number } index - indicates the record index in PasteData.
1083     * @param { PasteDataRecord } record - the content of a new record.
1084     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
1085     *    2. Incorrect parameters types.
1086     * @throws { BusinessError } 12900001 - The index is out of the record.
1087     * @syscap SystemCapability.MiscServices.Pasteboard
1088     * @atomicservice
1089     * @since 11
1090     */
1091    replaceRecord(index: number, record: PasteDataRecord): void;
1092
1093    /**
1094     * Utilized to notify pasteboard service while reading PasteData, in this case, the service will help to preserve the context and resources
1095     * @syscap SystemCapability.MiscServices.Pasteboard
1096     * @since 12
1097     */
1098    pasteStart(): void;
1099
1100    /**
1101     * Invoked to notify pasteboard service the utilization of PasteData has completed and occupied resources can be released for further usage
1102     * @syscap SystemCapability.MiscServices.Pasteboard
1103     * @since 12
1104     */
1105    pasteComplete(): void;
1106  }
1107
1108  /**
1109   * Classes for system pasteboard.
1110   * @interface SystemPasteboard
1111   * @syscap SystemCapability.MiscServices.Pasteboard
1112   * @since 6
1113   */
1114  /**
1115   * Classes for system pasteboard.
1116   * @interface SystemPasteboard
1117   * @syscap SystemCapability.MiscServices.Pasteboard
1118   * @atomicservice
1119   * @since 11
1120   */
1121  interface SystemPasteboard {
1122    /**
1123     * Callback invoked when pasteboard content changes.
1124     * @param { 'update' } type - indicates pasteboard content changed.
1125     * @param { function } callback - the callback to add.
1126     * @throws { BusinessError }  401 - Possible causes: 1. Mandatory parameters are left unspecified;
1127     *    2. Incorrect parameters types.
1128     * @syscap SystemCapability.MiscServices.Pasteboard
1129     * @since 7
1130     */
1131    on(type: 'update', callback: () => void): void;
1132
1133    /**
1134     * Remove a callback invoked when pasteboard content changes.
1135     * @param { 'update' } type - indicates pasteboard content changed.
1136     * @param { function } [callback] - the callback to remove. If this parameter is not filled in, it indicates that all
1137     * callbacks for this application will be cleared. Otherwise, it indicates that the specified callback will be cleared.
1138     * @throws { BusinessError }  401 - Possible causes: 1. Mandatory parameters are left unspecified;
1139     *    2. Incorrect parameters types.
1140     * @syscap SystemCapability.MiscServices.Pasteboard
1141     * @since 7
1142     */
1143    off(type: 'update', callback?: () => void): void;
1144
1145    /**
1146     * Checks whether the data is remote.
1147     * @returns { boolean } True is remote data, else false.
1148     * @throws { BusinessError } 12900005 - Request timed out.
1149     * @syscap SystemCapability.MiscServices.Pasteboard
1150     * @atomicservice
1151     * @since 11
1152     */
1153    isRemoteData(): boolean;
1154
1155    /**
1156     * Gets source of data.
1157     * @returns { string } data source.
1158     * @throws { BusinessError } 12900005 - Request timed out.
1159     * @syscap SystemCapability.MiscServices.Pasteboard
1160     * @atomicservice
1161     * @since 11
1162     */
1163    getDataSource(): string;
1164
1165    /**
1166     * Checks whether there is a specified MIME type of data in Data.
1167     * @param { string } mimeType - indicates to query data type.
1168     * @returns { boolean } if having mimeType in PasteData returns true, else returns false.
1169     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
1170     *    2. Incorrect parameters types.
1171     * @throws { BusinessError } 12900005 - Request timed out.
1172     * @syscap SystemCapability.MiscServices.Pasteboard
1173     * @atomicservice
1174     * @since 11
1175     */
1176    hasDataType(mimeType: string): boolean;
1177
1178    /**
1179     * Clears the pasteboard.
1180     * @param { AsyncCallback<void> } callback - the callback of clearData.
1181     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
1182     *    2. Incorrect parameters types.
1183     * @syscap SystemCapability.MiscServices.Pasteboard
1184     * @since 7
1185     * @deprecated since 9
1186     * @useinstead ohos.pasteboard.pasteboard#clearData
1187     */
1188    clear(callback: AsyncCallback<void>): void;
1189
1190    /**
1191     * Clears the pasteboard.
1192     * @returns { Promise<void> } the promise returned by the clearData.
1193     * @syscap SystemCapability.MiscServices.Pasteboard
1194     * @since 7
1195     * @deprecated since 9
1196     * @useinstead ohos.pasteboard.pasteboard#clearData
1197     */
1198    clear(): Promise<void>;
1199
1200    /**
1201     * Clears the pasteboard.
1202     * @param { AsyncCallback<void> } callback - the callback of clearData.
1203     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
1204     *    2. Incorrect parameters types.
1205     * @syscap SystemCapability.MiscServices.Pasteboard
1206     * @since 9
1207     */
1208    /**
1209     * Clears the pasteboard.
1210     * @param { AsyncCallback<void> } callback - the callback of clearData.
1211     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
1212     *    2. Incorrect parameters types.
1213     * @syscap SystemCapability.MiscServices.Pasteboard
1214     * @atomicservice
1215     * @since 11
1216     */
1217    clearData(callback: AsyncCallback<void>): void;
1218
1219    /**
1220     * Clears the pasteboard.
1221     * @returns { Promise<void> } the promise returned by the clearData.
1222     * @syscap SystemCapability.MiscServices.Pasteboard
1223     * @since 9
1224     */
1225    /**
1226     * Clears the pasteboard.
1227     * @returns { Promise<void> } the promise returned by the clearData.
1228     * @syscap SystemCapability.MiscServices.Pasteboard
1229     * @atomicservice
1230     * @since 11
1231     */
1232    clearData(): Promise<void>;
1233
1234    /**
1235     * Clears the pasteboard.
1236     * @throws { BusinessError } 12900005 - Request timed out.
1237     * @syscap SystemCapability.MiscServices.Pasteboard
1238     * @atomicservice
1239     * @since 11
1240     */
1241    clearDataSync(): void;
1242
1243    /**
1244     * Gets pastedata from the system pasteboard.
1245     * @param { AsyncCallback<PasteData> } callback - the callback of getData.
1246     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
1247     *    2. Incorrect  parameters types.
1248     * @syscap SystemCapability.MiscServices.Pasteboard
1249     * @since 6
1250     * @deprecated since 9
1251     * @useinstead ohos.pasteboard.pasteboard#getData
1252     */
1253    getPasteData(callback: AsyncCallback<PasteData>): void;
1254
1255    /**
1256     * Gets pastedata from the system pasteboard.
1257     * @returns { Promise<PasteData> } the promise returned by the getData.
1258     * @syscap SystemCapability.MiscServices.Pasteboard
1259     * @since 6
1260     * @deprecated since 9
1261     * @useinstead ohos.pasteboard.pasteboard#getData
1262     */
1263    getPasteData(): Promise<PasteData>;
1264
1265    /**
1266     * Gets pastedata from the system pasteboard.
1267     * @param { AsyncCallback<PasteData> } callback - the callback of getData.
1268     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
1269     *    2. Incorrect  parameters types.
1270     * @throws { BusinessError } 12900003 - Another copy or paste operation is in progress.
1271     * @syscap SystemCapability.MiscServices.Pasteboard
1272     * @since 9
1273     */
1274    /**
1275     * Gets pastedata from the system pasteboard.
1276     * @param { AsyncCallback<PasteData> } callback - the callback of getData.
1277     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
1278     *    2. Incorrect  parameters types.
1279     * @throws { BusinessError } 12900003 - Another copy or paste operation is in progress.
1280     * @syscap SystemCapability.MiscServices.Pasteboard
1281     * @atomicservice
1282     * @since 11
1283     */
1284    /**
1285     * Gets pastedata from the system pasteboard.
1286     * @permission ohos.permission.READ_PASTEBOARD
1287     * @param { AsyncCallback<PasteData> } callback - the callback of getData.
1288     * @throws { BusinessError } 201 - Permission verification failed. The application does not have the
1289     *    permission required to call the API.
1290     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
1291     *    2. Incorrect  parameters types.
1292     * @throws { BusinessError } 12900003 - Another copy or paste operation is in progress.
1293     * @syscap SystemCapability.MiscServices.Pasteboard
1294     * @atomicservice
1295     * @since 12
1296     */
1297    getData(callback: AsyncCallback<PasteData>): void;
1298
1299    /**
1300     * Gets pastedata from the system pasteboard.
1301     * @returns { Promise<PasteData> } the promise returned by the getData.
1302     * @throws { BusinessError } 12900003 - Another copy or paste operation is in progress.
1303     * @syscap SystemCapability.MiscServices.Pasteboard
1304     * @since 9
1305     */
1306    /**
1307     * Gets pastedata from the system pasteboard.
1308     * @returns { Promise<PasteData> } the promise returned by the getData.
1309     * @throws { BusinessError } 12900003 - Another copy or paste operation is in progress.
1310     * @syscap SystemCapability.MiscServices.Pasteboard
1311     * @atomicservice
1312     * @since 11
1313     */
1314    /**
1315     * Gets pastedata from the system pasteboard.
1316     * @permission ohos.permission.READ_PASTEBOARD
1317     * @returns { Promise<PasteData> } the promise returned by the getData.
1318     * @throws { BusinessError } 201 - Permission verification failed. The application does not have the
1319     *    permission required to call the API.
1320     * @throws { BusinessError } 12900003 - Another copy or paste operation is in progress.
1321     * @syscap SystemCapability.MiscServices.Pasteboard
1322     * @atomicservice
1323     * @since 12
1324     */
1325    getData(): Promise<PasteData>;
1326
1327    /**
1328     * Gets pasteData from the system pasteboard.
1329     * @returns { PasteData }  a new PasteData.
1330     * @throws { BusinessError } 12900005 - Request timed out.
1331     * @syscap SystemCapability.MiscServices.Pasteboard
1332     * @atomicservice
1333     * @since 11
1334     */
1335    /**
1336     * Gets pasteData from the system pasteboard.
1337     * @permission ohos.permission.READ_PASTEBOARD
1338     * @returns { PasteData }  a new PasteData.
1339     * @throws { BusinessError } 201 - Permission verification failed. The application does not have the
1340     *    permission required to call the API.
1341     * @throws { BusinessError } 12900005 - Request timed out.
1342     * @syscap SystemCapability.MiscServices.Pasteboard
1343     * @atomicservice
1344     * @since 12
1345     */
1346    getDataSync(): PasteData;
1347
1348    /**
1349     * Checks whether there is content in the pasteboard.
1350     * @param { AsyncCallback<boolean> } callback - the callback of setPasteData.
1351     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
1352     *    2. Incorrect  parameters types.
1353     * @syscap SystemCapability.MiscServices.Pasteboard
1354     * @since 7
1355     * @deprecated since 9
1356     * @useinstead ohos.pasteboard.pasteboard#hasData
1357     */
1358    hasPasteData(callback: AsyncCallback<boolean>): void;
1359
1360    /**
1361     * Checks whether there is content in the pasteboard.
1362     * @returns { Promise<boolean> } the promise returned by the function.
1363     * @syscap SystemCapability.MiscServices.Pasteboard
1364     * @since 7
1365     * @deprecated since 9
1366     * @useinstead ohos.pasteboard.pasteboard#hasData
1367     */
1368    hasPasteData(): Promise<boolean>;
1369
1370    /**
1371     * Checks whether there is content in the system pasteboard.
1372     * @param { AsyncCallback<boolean> } callback - the callback of hasData.
1373     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
1374     *    2. Incorrect  parameters types.
1375     * @syscap SystemCapability.MiscServices.Pasteboard
1376     * @since 9
1377     */
1378    /**
1379     * Checks whether there is content in the system pasteboard.
1380     * @param { AsyncCallback<boolean> } callback - the callback of hasData.
1381     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
1382     *    2. Incorrect  parameters types.
1383     * @syscap SystemCapability.MiscServices.Pasteboard
1384     * @atomicservice
1385     * @since 11
1386     */
1387    hasData(callback: AsyncCallback<boolean>): void;
1388
1389    /**
1390     * Checks whether there is content in the system pasteboard.
1391     * @returns { Promise<boolean> } the promise returned by the function.
1392     * @syscap SystemCapability.MiscServices.Pasteboard
1393     * @since 9
1394     */
1395    /**
1396     * Checks whether there is content in the system pasteboard.
1397     * @returns { Promise<boolean> } the promise returned by the function.
1398     * @syscap SystemCapability.MiscServices.Pasteboard
1399     * @atomicservice
1400     * @since 11
1401     */
1402    hasData(): Promise<boolean>;
1403
1404    /**
1405     * Checks whether there is content in the system pasteboard.
1406     * @returns { boolean } True exists, false does not exist.
1407     * @throws { BusinessError } 12900005 - Request timed out.
1408     * @syscap SystemCapability.MiscServices.Pasteboard
1409     * @atomicservice
1410     * @since 11
1411     */
1412    hasDataSync(): boolean;
1413
1414    /**
1415     * Writes PasteData to the pasteboard.
1416     * @param { PasteData } data - PasteData will be written to the clipboard
1417     * @param { AsyncCallback<void> } callback - the callback of setPasteData.
1418     * @throws { BusinessError } 401 - Possible causes: 1.  Mandatory parameters are left unspecified;
1419     *    2. Incorrect  parameters types.
1420     * @syscap SystemCapability.MiscServices.Pasteboard
1421     * @since 6
1422     * @deprecated since 9
1423     * @useinstead ohos.pasteboard.pasteboard#setData
1424     */
1425    setPasteData(data: PasteData, callback: AsyncCallback<void>): void;
1426
1427    /**
1428     * Writes PasteData to the pasteboard.
1429     * @param { PasteData } data - Containing the contents of the clipboard content object.
1430     * @returns { Promise<void> } the promise returned by the function.
1431     * @syscap SystemCapability.MiscServices.Pasteboard
1432     * @since 6
1433     * @deprecated since 9
1434     * @useinstead ohos.pasteboard.pasteboard#setData
1435     */
1436    setPasteData(data: PasteData): Promise<void>;
1437
1438    /**
1439     * Writes PasteData to the system pasteboard.
1440     * @param { PasteData } data - PasteData will be written to the clipboard
1441     * @param { AsyncCallback<void> } callback - the callback of setData.
1442     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified.
1443     *    2. Incorrect parameters types.
1444     * @throws { BusinessError } 12900003 - Another copy or paste operation is in progress.
1445     * @throws { BusinessError } 12900004 - Replication is prohibited.
1446     * @syscap SystemCapability.MiscServices.Pasteboard
1447     * @since 9
1448     */
1449    /**
1450     * Writes PasteData to the system pasteboard.
1451     * @param { PasteData } data - PasteData will be written to the clipboard
1452     * @param { AsyncCallback<void> } callback - the callback of setData.
1453     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
1454     *    2. Incorrect parameters types.
1455     * @throws { BusinessError } 12900003 - Another copy or paste operation is in progress.
1456     * @throws { BusinessError } 12900004 - Replication is prohibited.
1457     * @syscap SystemCapability.MiscServices.Pasteboard
1458     * @atomicservice
1459     * @since 11
1460     */
1461    setData(data: PasteData, callback: AsyncCallback<void>): void;
1462
1463    /**
1464     * Writes PasteData to the system pasteboard.
1465     * @param { PasteData } data - PasteData will be written to the clipboard.
1466     * @returns { Promise<void> } the promise returned by the function.
1467     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
1468     *    2. Incorrect  parameters types.
1469     * @throws { BusinessError } 12900003 - Another copy or paste operation is in progress.
1470     * @throws { BusinessError } 12900004 - Replication is prohibited.
1471     * @syscap SystemCapability.MiscServices.Pasteboard
1472     * @since 9
1473     */
1474    /**
1475     * Writes PasteData to the system pasteboard.
1476     * @param { PasteData } data - PasteData will be written to the clipboard.
1477     * @returns { Promise<void> } the promise returned by the function.
1478     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
1479     *    2. Incorrect  parameters types.
1480     * @throws { BusinessError } 12900003 - Another copy or paste operation is in progress.
1481     * @throws { BusinessError } 12900004 - Replication is prohibited.
1482     * @syscap SystemCapability.MiscServices.Pasteboard
1483     * @atomicservice
1484     * @since 11
1485     */
1486    setData(data: PasteData): Promise<void>;
1487
1488    /**
1489     * Writes PasteData to the system pasteboard.
1490     * @param { PasteData } data - PasteData will be written to the clipboard.
1491     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
1492     *    2. Incorrect parameters types.
1493     * @throws { BusinessError } 12900005 - Request timed out.
1494     * @syscap SystemCapability.MiscServices.Pasteboard
1495     * @atomicservice
1496     * @since 11
1497     */
1498    setDataSync(data: PasteData): void;
1499
1500    /**
1501     * Gets unified data from the system pasteboard.
1502     * @permission ohos.permission.READ_PASTEBOARD
1503     * @returns { Promise<unifiedDataChannel.UnifiedData> } the promise returned by the getData.
1504     * @throws { BusinessError } 201 - Permission verification failed. The application does not have the
1505     *    permission required to call the API.
1506     * @throws { BusinessError } 12900003 - Another copy or paste operation is in progress.
1507     * @syscap SystemCapability.MiscServices.Pasteboard
1508     * @atomicservice
1509     * @since 12
1510     */
1511    getUnifiedData(): Promise<unifiedDataChannel.UnifiedData>;
1512
1513    /**
1514     * Gets unified data from the system pasteboard.
1515     * @permission ohos.permission.READ_PASTEBOARD
1516     * @returns { unifiedDataChannel.UnifiedData }  a new UnifiedData.
1517     * @throws { BusinessError } 201 - Permission verification failed. The application does not have the
1518     *    permission required to call the API.
1519     * @throws { BusinessError } 12900005 - Request timed out.
1520     * @syscap SystemCapability.MiscServices.Pasteboard
1521     * @atomicservice
1522     * @since 12
1523     */
1524    getUnifiedDataSync(): unifiedDataChannel.UnifiedData;
1525
1526    /**
1527     * Writes unified data to the system pasteboard.
1528     * @param { unifiedDataChannel.UnifiedData } data - Unified data will be written to the pasteboard.
1529     * @returns { Promise<void> } the promise returned by the function.
1530     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
1531     *    2. Incorrect  parameters types.
1532     * @throws { BusinessError } 12900003 - Another copy or paste operation is in progress.
1533     * @throws { BusinessError } 12900004 - Replication is prohibited.
1534     * @syscap SystemCapability.MiscServices.Pasteboard
1535     * @atomicservice
1536     * @since 12
1537     */
1538    setUnifiedData(data: unifiedDataChannel.UnifiedData): Promise<void>;
1539
1540    /**
1541     * Writes unified data to the system pasteboard.
1542     * @param { unifiedDataChannel.UnifiedData } data - Unified data will be written to the pasteboard.
1543     * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
1544     *    2. Incorrect  parameters types.
1545     * @throws { BusinessError } 12900005 - Request timed out.
1546     * @syscap SystemCapability.MiscServices.Pasteboard
1547     * @atomicservice
1548     * @since 12
1549     */
1550    setUnifiedDataSync(data: unifiedDataChannel.UnifiedData): void;
1551
1552    /**
1553     * Sets a unified ShareOptions for your application, so that the PasteData copied from your application is applicable to this ShareOptions.
1554     *
1555     * @param { ShareOption } shareOptions - Scope that PasteData can be pasted.
1556     * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
1557     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1558     *                                                                   2. Incorrect parameter types;
1559     *                                                                   3. Parameter verification failed.
1560     * @throws { BusinessError } 12900006 - Settings already exist.
1561     * @syscap SystemCapability.MiscServices.Pasteboard
1562     * @systemapi
1563     * @since 12
1564     */
1565    /**
1566     * Sets a unified ShareOptions for your application, so that the PasteData copied from your application is applicable to this ShareOptions.
1567     *
1568     * @permission ohos.permission.MANAGE_PASTEBOARD_APP_SHARE_OPTION
1569     * @param { ShareOption } shareOptions - Scope that PasteData can be pasted, The parameter can only be set InApp.
1570     * @throws { BusinessError } 201 - Permission verification failed. The application does not have the
1571     *     permission required to call the API.
1572     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1573     *                                                                   2. Incorrect parameter types;
1574     *                                                                   3. Parameter verification failed.
1575     * @throws { BusinessError } 12900006 - Settings already exist.
1576     * @syscap SystemCapability.MiscServices.Pasteboard
1577     * @since 14
1578     */
1579    setAppShareOptions(shareOptions: ShareOption): void;
1580
1581    /**
1582     * Removes the unified ShareOptions of your application.
1583     *
1584     * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
1585     * @syscap SystemCapability.MiscServices.Pasteboard
1586     * @systemapi
1587     * @since 12
1588     */
1589    /**
1590     * Removes the unified ShareOptions of your application.
1591     *
1592     * @permission ohos.permission.MANAGE_PASTEBOARD_APP_SHARE_OPTION
1593     * @throws { BusinessError } 201 - Permission verification failed. The application does not have the
1594     *    permission required to call the API.
1595     * @syscap SystemCapability.MiscServices.Pasteboard
1596     * @since 14
1597     */
1598    removeAppShareOptions(): void;
1599
1600    /**
1601     * Detects the patterns in the pasteboard.
1602     *
1603     * @param { Array<Pattern> } patterns - Patterns to detect.
1604     * @returns { Promise<Array<Pattern>> } Promise used to return the patterns detected.
1605     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1606     *                                                                   2. Incorrect parameter types;
1607     *                                                                   3. Parameter verification failed.
1608     * @syscap SystemCapability.MiscServices.Pasteboard
1609     * @since 13
1610     */
1611    detectPatterns(patterns: Array<Pattern>): Promise<Array<Pattern>>;
1612
1613    /**
1614     * Get the MIME types in the pasteboard.
1615     *
1616     * @returns { Promise<Array<string>> } Promise used to return the MIME types.
1617     * @syscap SystemCapability.MiscServices.Pasteboard
1618     * @atomicservice
1619     * @since 14
1620     */
1621    getMimeTypes(): Promise<Array<string>>;
1622  }
1623}
1624
1625export default pasteboard;
1626