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 #ifndef BASE_LOCATION_DISTRIBUTED_NOTIFICATION_SERVICE_FRAMEWORKS_JS_NAPI_INCLUDE_COMMON_H
16 #define BASE_LOCATION_DISTRIBUTED_NOTIFICATION_SERVICE_FRAMEWORKS_JS_NAPI_INCLUDE_COMMON_H
17 
18 #include "location_log.h"
19 #include "napi/native_api.h"
20 #include "napi/native_node_api.h"
21 #include "notification_button_option.h"
22 #include "notification_helper.h"
23 #include "notification_local_live_view_button.h"
24 #include "notification_progress.h"
25 #include "notification_time.h"
26 #include "ans_convert_enum.h"
27 
28 namespace OHOS {
29 namespace Location {
30 using namespace OHOS::Notification;
31 using namespace OHOS::NotificationNapi;
32 
33 constexpr int32_t STR_MAX_SIZE = 200;
34 constexpr int32_t LONG_STR_MAX_SIZE = 1024;
35 constexpr uint8_t OPERATION_MAX_TYPE = 3;
36 constexpr int8_t NO_ERROR = 0;
37 constexpr int8_t ERROR = -1;
38 
39 enum class SemanticActionButton {
40     NONE_ACTION_BUTTON,
41     REPLY_ACTION_BUTTON,
42     READ_ACTION_BUTTON,
43     UNREAD_ACTION_BUTTON,
44     DELETE_ACTION_BUTTON,
45     ARCHIVE_ACTION_BUTTON,
46     MUTE_ACTION_BUTTON,
47     UNMUTE_ACTION_BUTTON,
48     THUMBS_UP_ACTION_BUTTON,
49     THUMBS_DOWN_ACTION_BUTTON,
50     CALL_ACTION_BUTTON
51 };
52 
53 enum class InputsSource {
54     FREE_FORM_INPUT,
55     OPTION
56 };
57 
58 enum class DisturbMode {
59     ALLOW_UNKNOWN,
60     ALLOW_ALL,
61     ALLOW_PRIORITY,
62     ALLOW_NONE,
63     ALLOW_ALARMS
64 };
65 
66 enum class InputEditType {
67     EDIT_AUTO,
68     EDIT_DISABLED,
69     EDIT_ENABLED
70 };
71 
72 
73 enum class NotificationFlagStatus {
74     TYPE_NONE,
75     TYPE_OPEN,
76     TYPE_CLOSE
77 };
78 
79 struct NotificationSubscribeInfo {
80     std::vector<std::string> bundleNames;
81     int32_t userId = 0;
82     bool hasSubscribeInfo = false;
83 };
84 
85 struct CallbackPromiseInfo {
86     napi_ref callback = nullptr;
87     napi_deferred deferred = nullptr;
88     bool isCallback = false;
89     int32_t errorCode = 0;
90 };
91 
92 class NotificationNapi {
93     NotificationNapi();
94 
95     ~NotificationNapi();
96 
97 public:
98     /**
99      * @brief Gets a napi value that is used to represent specified bool value
100      *
101      * @param env Indicates the environment that the API is invoked under
102      * @param isValue Indicates a bool value
103      * @return Returns a napi value that is used to represent specified bool value
104      */
105     static napi_value NapiGetBoolean(napi_env env, const bool &isValue);
106 
107     /**
108      * @brief Gets the napi value that is used to represent the null object
109      *
110      * @param env Indicates the environment that the API is invoked under
111      * @return Returns the napi value that is used to represent the null object
112      */
113     static napi_value NapiGetNull(napi_env env);
114 
115     /**
116      * @brief Gets the napi value that is used to represent the undefined object
117      *
118      * @param env Indicates the environment that the API is invoked under
119      * @return Returns the napi value that is used to represent the undefined object
120      */
121     static napi_value NapiGetUndefined(napi_env env);
122 
123     /**
124      * @brief Gets a napi value with specified error code for callback
125      *
126      * @param env Indicates the environment that the API is invoked under
127      * @param errCode Indicates specified err code
128      * @return Returns a napi value with specified error code for callback
129      */
130     static napi_value GetCallbackErrorValue(napi_env env, int32_t errCode);
131 
132     /**
133      * @brief Pads the CallbackPromiseInfo struct
134      *
135      * @param env Indicates the environment that the API is invoked under
136      * @param callback Indicates a napi_ref for callback
137      * @param info Indicates the CallbackPromiseInfo struct to be padded
138      * @param promise Indicates the promise to be created when the callback is null
139      */
140     static void PaddingCallbackPromiseInfo(
141         const napi_env &env, const napi_ref &callback, CallbackPromiseInfo &info, napi_value &promise);
142 
143     /**
144      * @brief Gets the returned result by the CallbackPromiseInfo struct
145      *
146      * @param env Indicates the environment that the API is invoked under
147      * @param info Indicates the CallbackPromiseInfo struct
148      * @param result Indicates the returned result
149      */
150     static void ReturnCallbackPromise(const napi_env &env, const CallbackPromiseInfo &info, const napi_value &result);
151 
152     /**
153      * @brief Calls the callback with the result and error code
154      *
155      * @param env Indicates the environment that the API is invoked under
156      * @param callbackIn Indicates the callback to be called
157      * @param errCode Indicates the error code returned by the callback
158      * @param result Indicates the result returned by the callback
159      */
160     static void SetCallback(const napi_env &env,
161         const napi_ref &callbackIn, const int32_t &errorCode, const napi_value &result, bool newType);
162 
163     /**
164      * @brief Calls the callback with the result
165      *
166      * @param env Indicates the environment that the API is invoked under
167      * @param callbackIn Indicates the callback to be called
168      * @param result Indicates the result returned by the callback
169      */
170     static void SetCallback(
171         const napi_env &env, const napi_ref &callbackIn, const napi_value &result);
172 
173     /**
174      * @brief Calls the callback with the result
175      *
176      * @param env Indicates the environment that the API is invoked under
177      * @param callbackIn Indicates the callback to be called
178      * @param result Indicates the result returned by the callback
179      */
180     static void SetCallbackArg2(
181         const napi_env &env, const napi_ref &callbackIn, const napi_value &result0, const napi_value &result1);
182 
183     /**
184      * @brief Processes the promise with the result and error code
185      *
186      * @param env Indicates the environment that the API is invoked under
187      * @param deferred Indicates the deferred object whose associated promise to resolve
188      * @param errorCode Indicates the error code returned by the callback
189      * @param result Indicates the result returned by the callback
190      */
191     static void SetPromise(const napi_env &env,
192         const napi_deferred &deferred, const int32_t &errorCode, const napi_value &result, bool newType);
193 
194     /**
195      * @brief Gets the returned result by the callback when an error occurs
196      *
197      * @param env Indicates the environment that the API is invoked under
198      * @param callback Indicates a napi_ref for callback
199      * @return Returns the null object
200      */
201     static napi_value JSParaError(const napi_env &env, const napi_ref &callback);
202 
203     /**
204      * @brief Parses a single parameter for callback
205      *
206      * @param env Indicates the environment that the API is invoked under
207      * @param info Indicates the callback info passed into the callback function
208      * @param callback Indicates the napi_ref for the callback parameter
209      * @return Returns the null object if success, returns the null value otherwise
210      */
211     static napi_value ParseParaOnlyCallback(const napi_env &env, const napi_callback_info &info, napi_ref &callback);
212 
213     /**
214      * @brief Gets a NotificationSubscribeInfo object from specified js object
215      *
216      * @param env Indicates the environment that the API is invoked under
217      * @param value Indicates a js object to be converted
218      * @param result Indicates a NotificationSubscribeInfo object from specified js object
219      * @return Returns the null object if success, returns the null value otherwise
220      */
221     static napi_value GetNotificationSubscriberInfo(
222         const napi_env &env, const napi_value &value, NotificationSubscribeInfo &result);
223 
224     /**
225      * @brief Gets a NotificationRequest object from specified js object
226      *
227      * @param env Indicates the environment that the API is invoked under
228      * @param value Indicates a js object to be converted
229      * @param result Indicates a NotificationRequest object from specified js object
230      * @return Returns the null object if success, returns the null value otherwise
231      */
232     static napi_value GetNotificationRequest(
233         const napi_env &env, const napi_value &value, NotificationRequest &request);
234 
235     /**
236      * @brief Gets a NotificationRequest object by number type from specified js object
237      *
238      * @param env Indicates the environment that the API is invoked under
239      * @param value Indicates a js object to be converted
240      * @param request Indicates a NotificationRequest object from specified js object
241      * @return Returns the null object if success, returns the null value otherwise
242      */
243     static napi_value GetNotificationRequestByNumber(
244         const napi_env &env, const napi_value &value, NotificationRequest &request);
245 
246     /**
247      * @brief Gets a NotificationRequest object by string type from specified js object
248      *
249      * @param env Indicates the environment that the API is invoked under
250      * @param value Indicates a js object to be converted
251      * @param request Indicates a NotificationRequest object from specified js object
252      * @return Returns the null object if success, returns the null value otherwise
253      */
254     static napi_value GetNotificationRequestByString(
255         const napi_env &env, const napi_value &value, NotificationRequest &request);
256 
257     /**
258      * @brief Gets a NotificationRequest object by bool type from specified js object
259      *
260      * @param env Indicates the environment that the API is invoked under
261      * @param value Indicates a js object to be converted
262      * @param request Indicates a NotificationRequest object from specified js object
263      * @return Returns the null object if success, returns the null value otherwise
264      */
265     static napi_value GetNotificationRequestByBool(
266         const napi_env &env, const napi_value &value, NotificationRequest &request);
267 
268     /**
269      * @brief Gets a NotificationRequest object by custom type from specified js object
270      *
271      * @param env Indicates the environment that the API is invoked under
272      * @param value Indicates a js object to be converted
273      * @param request Indicates a NotificationRequest object from specified js object
274      * @return Returns the null object if success, returns the null value otherwise
275      */
276     static napi_value GetNotificationRequestByCustom(
277         const napi_env &env, const napi_value &value, NotificationRequest &request);
278 
279     /**
280      * @brief Gets the id of NotificationRequest object from specified js object
281      *
282      * @param env Indicates the environment that the API is invoked under
283      * @param value Indicates a js object to be converted
284      * @param request Indicates a NotificationRequest object from specified js object
285      * @return Returns the null object if success, returns the null value otherwise
286      */
287     static napi_value GetNotificationId(const napi_env &env, const napi_value &value, NotificationRequest &request);
288 
289     /**
290      * @brief Gets the slot type of NotificationRequest object from specified js object
291      *
292      * @param env Indicates the environment that the API is invoked under
293      * @param value Indicates a js object to be converted
294      * @param request Indicates a NotificationRequest object from specified js object
295      * @return Returns the null object if success, returns the null value otherwise
296      */
297     static napi_value GetNotificationSlotType(
298         const napi_env &env, const napi_value &value, NotificationRequest &request);
299 
300     /**
301      * @brief Gets the isOngoing flag of NotificationRequest object from specified js object
302      *
303      * @param env Indicates the environment that the API is invoked under
304      * @param value Indicates a js object to be converted
305      * @param request Indicates a NotificationRequest object from specified js object
306      * @return Returns the null object if success, returns the null value otherwise
307      */
308     static napi_value GetNotificationIsOngoing(
309         const napi_env &env, const napi_value &value, NotificationRequest &request);
310 
311     /**
312      * @brief Gets the isUnremovable flag of NotificationRequest object from specified js object
313      *
314      * @param env Indicates the environment that the API is invoked under
315      * @param value Indicates a js object to be converted
316      * @param request Indicates a NotificationRequest object from specified js object
317      * @return Returns the null object if success, returns the null value otherwise
318      */
319     static napi_value GetNotificationIsUnremovable(
320         const napi_env &env, const napi_value &value, NotificationRequest &request);
321 
322     /**
323      * @brief Gets the delivery time of NotificationRequest object from specified js object
324      *
325      * @param env Indicates the environment that the API is invoked under
326      * @param value Indicates a js object to be converted
327      * @param request Indicates a NotificationRequest object from specified js object
328      * @return Returns the null object if success, returns the null value otherwise
329      */
330     static napi_value GetNotificationDeliveryTime(
331         const napi_env &env, const napi_value &value, NotificationRequest &request);
332 
333     /**
334      * @brief Gets the tapDismissed flag of NotificationRequest object from specified js object
335      *
336      * @param env Indicates the environment that the API is invoked under
337      * @param value Indicates a js object to be converted
338      * @param request Indicates a NotificationRequest object from specified js object
339      * @return Returns the null object if success, returns the null value otherwise
340      */
341     static napi_value GetNotificationtapDismissed(
342         const napi_env &env, const napi_value &value, NotificationRequest &request);
343 
344     /**
345      * @brief Gets the extra information of NotificationRequest object from specified js object
346      *
347      * @param env Indicates the environment that the API is invoked under
348      * @param value Indicates a js object to be converted
349      * @param request Indicates a NotificationRequest object from specified js object
350      * @return Returns the null object if success, returns the null value otherwise
351      */
352     static napi_value GetNotificationExtraInfo(
353         const napi_env &env, const napi_value &value, NotificationRequest &request);
354 
355     /**
356      * @brief Gets the group name of NotificationRequest object from specified js object
357      *
358      * @param env Indicates the environment that the API is invoked under
359      * @param value Indicates a js object to be converted
360      * @param request Indicates a NotificationRequest object from specified js object
361      * @return Returns the null object if success, returns the null value otherwise
362      */
363     static napi_value GetNotificationGroupName(
364         const napi_env &env, const napi_value &value, NotificationRequest &request);
365 
366     /**
367      * @brief Gets the removal WantAgent object of NotificationRequest object from specified js object
368      *
369      * @param env Indicates the environment that the API is invoked under
370      * @param value Indicates a js object to be converted
371      * @param request Indicates a NotificationRequest object from specified js object
372      * @return Returns the null object if success, returns the null value otherwise
373      */
374     static napi_value GetNotificationRemovalWantAgent(
375         const napi_env &env, const napi_value &value, NotificationRequest &request);
376 
377     /**
378      * @brief Gets the max screen WantAgent object of NotificationRequest object from specified js object
379      *
380      * @param env Indicates the environment that the API is invoked under
381      * @param value Indicates a js object to be converted
382      * @param request Indicates a NotificationRequest object from specified js object
383      * @return Returns the null object if success, returns the null value otherwise
384      */
385     static napi_value GetNotificationMaxScreenWantAgent(
386         const napi_env &env, const napi_value &value, NotificationRequest &request);
387 
388     /**
389      * @brief Gets the auto deleted time of NotificationRequest object from specified js object
390      *
391      * @param env Indicates the environment that the API is invoked under
392      * @param value Indicates a js object to be converted
393      * @param request Indicates a NotificationRequest object from specified js object
394      * @return Returns the null object if success, returns the null value otherwise
395      */
396     static napi_value GetNotificationAutoDeletedTime(
397         const napi_env &env, const napi_value &value, NotificationRequest &request);
398 
399     /**
400      * @brief Gets the classification of NotificationRequest object from specified js object
401      *
402      * @param env Indicates the environment that the API is invoked under
403      * @param value Indicates a js object to be converted
404      * @param request Indicates a NotificationRequest object from specified js object
405      * @return Returns the null object if success, returns the null value otherwise
406      */
407     static napi_value GetNotificationClassification(
408         const napi_env &env, const napi_value &value, NotificationRequest &request);
409 
410     /**
411      * @brief Gets the appMessageId of NotificationRequest object from specified js object
412      *
413      * @param env Indicates the environment that the API is invoked under
414      * @param value Indicates a js object to be converted
415      * @param request Indicates a NotificationRequest object from specified js object
416      * @return Returns the null object if success, returns the null value otherwise
417      */
418     static napi_value GetNotificationAppMessageId(
419         const napi_env &env, const napi_value &value, NotificationRequest &request);
420 
421     /**
422      * @brief Gets the color of NotificationRequest object from specified js object
423      *
424      * @param env Indicates the environment that the API is invoked under
425      * @param value Indicates a js object to be converted
426      * @param request Indicates a NotificationRequest object from specified js object
427      * @return Returns the null object if success, returns the null value otherwise
428      */
429     static napi_value GetNotificationColor(const napi_env &env, const napi_value &value, NotificationRequest &request);
430 
431     /**
432      * @brief Gets the colorEnabled flag of NotificationRequest object from specified js object
433      *
434      * @param env Indicates the environment that the API is invoked under
435      * @param value Indicates a js object to be converted
436      * @param request Indicates a NotificationRequest object from specified js object
437      * @return Returns the null object if success, returns the null value otherwise
438      */
439     static napi_value GetNotificationColorEnabled(
440         const napi_env &env, const napi_value &value, NotificationRequest &request);
441 
442     /**
443      * @brief Gets the isAlertOnce flag of NotificationRequest object from specified js object
444      *
445      * @param env Indicates the environment that the API is invoked under
446      * @param value Indicates a js object to be converted
447      * @param request Indicates a NotificationRequest object from specified js object
448      * @return Returns the null object if success, returns the null value otherwise
449      */
450     static napi_value GetNotificationIsAlertOnce(
451         const napi_env &env, const napi_value &value, NotificationRequest &request);
452 
453     /**
454      * @brief Gets the isStopwatch flag of NotificationRequest object from specified js object
455      *
456      * @param env Indicates the environment that the API is invoked under
457      * @param value Indicates a js object to be converted
458      * @param request Indicates a NotificationRequest object from specified js object
459      * @return Returns the null object if success, returns the null value otherwise
460      */
461     static napi_value GetNotificationIsStopwatch(
462         const napi_env &env, const napi_value &value, NotificationRequest &request);
463 
464     /**
465      * @brief Gets the isCountDown flag of NotificationRequest object from specified js object
466      *
467      * @param env Indicates the environment that the API is invoked under
468      * @param value Indicates a js object to be converted
469      * @param request Indicates a NotificationRequest object from specified js object
470      * @return Returns the null object if success, returns the null value otherwise
471      */
472     static napi_value GetNotificationIsCountDown(
473         const napi_env &env, const napi_value &value, NotificationRequest &request);
474 
475     /**
476      * @brief Gets the status bar text of NotificationRequest object from specified js object
477      *
478      * @param env Indicates the environment that the API is invoked under
479      * @param value Indicates a js object to be converted
480      * @param request Indicates a NotificationRequest object from specified js object
481      * @return Returns the null object if success, returns the null value otherwise
482      */
483     static napi_value GetNotificationStatusBarText(
484         const napi_env &env, const napi_value &value, NotificationRequest &request);
485 
486     /**
487      * @brief Gets the label of NotificationRequest object from specified js object
488      *
489      * @param env Indicates the environment that the API is invoked under
490      * @param value Indicates a js object to be converted
491      * @param request Indicates a NotificationRequest object from specified js object
492      * @return Returns the null object if success, returns the null value otherwise
493      */
494     static napi_value GetNotificationLabel(const napi_env &env, const napi_value &value, NotificationRequest &request);
495 
496     /**
497      * @brief Gets the badge icon style of NotificationRequest object from specified js object
498      *
499      * @param env Indicates the environment that the API is invoked under
500      * @param value Indicates a js object to be converted
501      * @param request Indicates a NotificationRequest object from specified js object
502      * @return Returns the null object if success, returns the null value otherwise
503      */
504     static napi_value GetNotificationBadgeIconStyle(
505         const napi_env &env, const napi_value &value, NotificationRequest &request);
506 
507     /**
508      * @brief Gets the showDeliveryTime flag of NotificationRequest object from specified js object
509      *
510      * @param env Indicates the environment that the API is invoked under
511      * @param value Indicates a js object to be converted
512      * @param request Indicates a NotificationRequest object from specified js object
513      * @return Returns the null object if success, returns the null value otherwise
514      */
515     static napi_value GetNotificationShowDeliveryTime(
516         const napi_env &env, const napi_value &value, NotificationRequest &request);
517 
518     static napi_value GetNotificationIsRemoveAllowed(
519         const napi_env &env, const napi_value &value, NotificationRequest &request);
520 
521     /**
522      * @brief Gets the content of NotificationRequest object from specified js object
523      *
524      * @param env Indicates the environment that the API is invoked under
525      * @param value Indicates a js object to be converted
526      * @param request Indicates a NotificationRequest object from specified js object
527      * @return Returns the null object if success, returns the null value otherwise
528      */
529     static napi_value GetNotificationContent(
530         const napi_env &env, const napi_value &value, NotificationRequest &request);
531 
532     /**
533      * @brief Gets the WantAgent object of NotificationRequest object from specified js object
534      *
535      * @param env Indicates the environment that the API is invoked under
536      * @param value Indicates a js object to be converted
537      * @param request Indicates a NotificationRequest object from specified js object
538      * @return Returns the null object if success, returns the null value otherwise
539      */
540     static napi_value GetNotificationWantAgent(
541         const napi_env &env, const napi_value &value, NotificationRequest &request);
542 
543     /**
544      * @brief Gets a NotificationSlot object from specified js object
545      *
546      * @param env Indicates the environment that the API is invoked under
547      * @param value Indicates a js object to be converted
548      * @param slot Indicates a NotificationSlot object from specified js object
549      * @return Returns the null object if success, returns the null value otherwise
550      */
551     static napi_value GetNotificationSlot(
552         const napi_env &env, const napi_value &value, NotificationSlot &slot);
553 
554     /**
555      * @brief Gets the string objects of NotificationSlot object from specified js object
556      *
557      * @param env Indicates the environment that the API is invoked under
558      * @param value Indicates a js object to be converted
559      * @param slot Indicates a NotificationSlot object from specified js object
560      * @return Returns the null object if success, returns the null value otherwise
561      */
562     static napi_value GetNotificationSlotByString(
563         const napi_env &env, const napi_value &value, NotificationSlot &slot);
564 
565     /**
566      * @brief Gets the bool objects of NotificationSlot object from specified js object
567      *
568      * @param env Indicates the environment that the API is invoked under
569      * @param value Indicates a js object to be converted
570      * @param slot Indicates a NotificationSlot object from specified js object
571      * @return Returns the null object if success, returns the null value otherwise
572      */
573     static napi_value GetNotificationSlotByBool(
574         const napi_env &env, const napi_value &value, NotificationSlot &slot);
575 
576     /**
577      * @brief Gets the number objects of NotificationSlot object from specified js object
578      *
579      * @param env Indicates the environment that the API is invoked under
580      * @param value Indicates a js object to be converted
581      * @param slot Indicates a NotificationSlot object from specified js object
582      * @return Returns the null object if success, returns the null value otherwise
583      */
584     static napi_value GetNotificationSlotByNumber(
585         const napi_env &env, const napi_value &value, NotificationSlot &slot);
586 
587     /**
588      * @brief Gets the vibration of NotificationSlot object from specified js object
589      *
590      * @param env Indicates the environment that the API is invoked under
591      * @param value Indicates a js object to be converted
592      * @param slot Indicates a NotificationSlot object from specified js object
593      * @return Returns the null object if success, returns the null value otherwise
594      */
595     static napi_value GetNotificationSlotByVibration(
596         const napi_env &env, const napi_value &value, NotificationSlot &slot);
597 
598     /**
599      * @brief Gets the action buttons of NotificationRequest object from specified js object
600      *
601      * @param env Indicates the environment that the API is invoked under
602      * @param value Indicates a js object to be converted
603      * @param request Indicates a NotificationRequest object from specified js object
604      * @return Returns the null object if success, returns the null value otherwise
605      */
606     static napi_value GetNotificationActionButtons(
607         const napi_env &env, const napi_value &value, NotificationRequest &request);
608 
609     /**
610      * @brief Gets a NotificationActionButton object from specified js object
611      *
612      * @param env Indicates the environment that the API is invoked under
613      * @param actionButton Indicates a js object to be converted
614      * @param pActionButton Indicates a NotificationActionButton object from specified js object
615      * @return Returns the null object if success, returns the null value otherwise
616      */
617     static napi_value GetNotificationActionButtonsDetailed(
618         const napi_env &env, const napi_value &actionButton, std::shared_ptr<NotificationActionButton> &pActionButton);
619 
620     /**
621      * @brief Gets the basic information of NotificationActionButton object from specified js object
622      *
623      * @param env Indicates the environment that the API is invoked under
624      * @param actionButton Indicates a js object to be converted
625      * @param pActionButton Indicates a NotificationActionButton object from specified js object
626      * @return Returns the null object if success, returns the null value otherwise
627      */
628     static napi_value GetNotificationActionButtonsDetailedBasicInfo(
629         const napi_env &env, const napi_value &actionButton, std::shared_ptr<NotificationActionButton> &pActionButton);
630 
631     /**
632      * @brief Gets the extras of NotificationActionButton object from specified js object
633      *
634      * @param env Indicates the environment that the API is invoked under
635      * @param actionButton Indicates a js object to be converted
636      * @param pActionButton Indicates a NotificationActionButton object from specified js object
637      * @return Returns the null object if success, returns the null value otherwise
638      */
639     static napi_value GetNotificationActionButtonsDetailedByExtras(
640         const napi_env &env, const napi_value &actionButton, std::shared_ptr<NotificationActionButton> &pActionButton);
641 
642     /**
643      * @brief Gets the user input of NotificationActionButton object from specified js object
644      *
645      * @param env Indicates the environment that the API is invoked under
646      * @param actionButton Indicates a js object to be converted
647      * @param pActionButton Indicates a NotificationActionButton object from specified js object
648      * @return Returns the null object if success, returns the null value otherwise
649      */
650     static napi_value GetNotificationUserInput(
651         const napi_env &env, const napi_value &actionButton, std::shared_ptr<NotificationActionButton> &pActionButton);
652 
653     /**
654      * @brief Gets the input key of NotificationUserInput object from specified js object
655      *
656      * @param env Indicates the environment that the API is invoked under
657      * @param userInputResult Indicates a js object to be converted
658      * @param userInput Indicates a NotificationUserInput object from specified js object
659      * @return Returns the null object if success, returns the null value otherwise
660      */
661     static napi_value GetNotificationUserInputByInputKey(
662         const napi_env &env, const napi_value &userInputResult, std::shared_ptr<NotificationUserInput> &userInput);
663 
664     /**
665      * @brief Gets the tag of NotificationUserInput object from specified js object
666      *
667      * @param env Indicates the environment that the API is invoked under
668      * @param userInputResult Indicates a js object to be converted
669      * @param userInput Indicates a NotificationUserInput object from specified js object
670      * @return Returns the null object if success, returns the null value otherwise
671      */
672     static napi_value GetNotificationUserInputByTag(
673         const napi_env &env, const napi_value &userInputResult, std::shared_ptr<NotificationUserInput> &userInput);
674 
675     /**
676      * @brief Gets the options of NotificationUserInput object from specified js object
677      *
678      * @param env Indicates the environment that the API is invoked under
679      * @param userInputResult Indicates a js object to be converted
680      * @param userInput Indicates a NotificationUserInput object from specified js object
681      * @return Returns the null object if success, returns the null value otherwise
682      */
683     static napi_value GetNotificationUserInputByOptions(
684         const napi_env &env, const napi_value &userInputResult, std::shared_ptr<NotificationUserInput> &userInput);
685 
686     /**
687      * @brief Gets the permit mime types of NotificationUserInput object from specified js object
688      *
689      * @param env Indicates the environment that the API is invoked under
690      * @param userInputResult Indicates a js object to be converted
691      * @param userInput Indicates a NotificationUserInput object from specified js object
692      * @return Returns the null object if success, returns the null value otherwise
693      */
694     static napi_value GetNotificationUserInputByPermitMimeTypes(
695         const napi_env &env, const napi_value &userInputResult, std::shared_ptr<NotificationUserInput> &userInput);
696 
697     /**
698      * @brief Gets the permit free from input of NotificationUserInput object from specified js object
699      *
700      * @param env Indicates the environment that the API is invoked under
701      * @param userInputResult Indicates a js object to be converted
702      * @param userInput Indicates a NotificationUserInput object from specified js object
703      * @return Returns the null object if success, returns the null value otherwise
704      */
705     static napi_value GetNotificationUserInputByPermitFreeFormInput(
706         const napi_env &env, const napi_value &userInputResult, std::shared_ptr<NotificationUserInput> &userInput);
707 
708     /**
709      * @brief Gets the edit type of NotificationUserInput object from specified js object
710      *
711      * @param env Indicates the environment that the API is invoked under
712      * @param userInputResult Indicates a js object to be converted
713      * @param userInput Indicates a NotificationUserInput object from specified js object
714      * @return Returns the null object if success, returns the null value otherwise
715      */
716     static napi_value GetNotificationUserInputByEditType(
717         const napi_env &env, const napi_value &userInputResult, std::shared_ptr<NotificationUserInput> &userInput);
718 
719     /**
720      * @brief Gets the additional data of NotificationUserInput object from specified js object
721      *
722      * @param env Indicates the environment that the API is invoked under
723      * @param userInputResult Indicates a js object to be converted
724      * @param userInput Indicates a NotificationUserInput object from specified js object
725      * @return Returns the null object if success, returns the null value otherwise
726      */
727     static napi_value GetNotificationUserInputByAdditionalData(
728         const napi_env &env, const napi_value &userInputResult, std::shared_ptr<NotificationUserInput> &userInput);
729 
730     /**
731      * @brief Gets the small icon of NotificationRequest object from specified js object
732      *
733      * @param env Indicates the environment that the API is invoked under
734      * @param value Indicates a js object to be converted
735      * @param request Indicates a NotificationRequest object from specified js object
736      * @return Returns the null object if success, returns the null value otherwise
737      */
738     static napi_value GetNotificationSmallIcon(
739         const napi_env &env, const napi_value &value, NotificationRequest &request);
740 
741     /**
742      * @brief Gets the large icon of NotificationRequest object from specified js object
743      *
744      * @param env Indicates the environment that the API is invoked under
745      * @param value Indicates a js object to be converted
746      * @param request Indicates a NotificationRequest object from specified js object
747      * @return Returns the null object if success, returns the null value otherwise
748      */
749     static napi_value GetNotificationLargeIcon(
750         const napi_env &env, const napi_value &value, NotificationRequest &request);
751 
752     /**
753      * @brief Gets the overlay icon of NotificationRequest object from specified js object
754      *
755      * @param env Indicates the environment that the API is invoked under
756      * @param value Indicates a js object to be converted
757      * @param request Indicates a NotificationRequest object from specified js object
758      * @return Returns the null object if success, returns the null value otherwise
759      */
760     static napi_value GetNotificationOverlayIcon(
761         const napi_env &env, const napi_value &value, NotificationRequest &request);
762 
763     /**
764      * @brief Gets the distributed options of NotificationRequest object from specified js object
765      *
766      * @param env Indicates the environment that the API is invoked under
767      * @param value Indicates a js object to be converted
768      * @param request Indicates a NotificationRequest object from specified js object
769      * @return Returns the null object if success, returns the null value otherwise
770      */
771     static napi_value GetNotificationRequestDistributedOptions(
772         const napi_env &env, const napi_value &value, NotificationRequest &request);
773 
774     /**
775      * @brief Gets the isDistributed flag of NotificationRequest object from specified js object
776      *
777      * @param env Indicates the environment that the API is invoked under
778      * @param value Indicates a js object to be converted
779      * @param request Indicates a NotificationRequest object from specified js object
780      * @return Returns the null object if success, returns the null value otherwise
781      */
782     static napi_value GetNotificationIsDistributed(
783         const napi_env &env, const napi_value &value, NotificationRequest &request);
784 
785     /**
786      * @brief Gets the devices that support display of NotificationRequest object from specified js object
787      *
788      * @param env Indicates the environment that the API is invoked under
789      * @param value Indicates a js object to be converted
790      * @param request Indicates a NotificationRequest object from specified js object
791      * @return Returns the null object if success, returns the null value otherwise
792      */
793     static napi_value GetNotificationSupportDisplayDevices(
794         const napi_env &env, const napi_value &value, NotificationRequest &request);
795 
796     /**
797      * @brief Gets the devices that support operation of NotificationRequest object from specified js object
798      *
799      * @param env Indicates the environment that the API is invoked under
800      * @param value Indicates a js object to be converted
801      * @param request Indicates a NotificationRequest object from specified js object
802      * @return Returns the null object if success, returns the null value otherwise
803      */
804     static napi_value GetNotificationSupportOperateDevices(
805         const napi_env &env, const napi_value &value, NotificationRequest &request);
806 
807     /**
808      * @brief Gets a content type of notification from specified js object
809      *
810      * @param env Indicates the environment that the API is invoked under
811      * @param value Indicates a js object to be converted
812      * @param type Indicates a the content type of notification from specified js object
813      * @return Returns the null object if success, returns the null value otherwise
814      */
815     static napi_value GetNotificationContentType(const napi_env &env, const napi_value &result, int32_t &type);
816 
817     /**
818      * @brief Gets a basic content of NotificationRequest object from specified js object
819      *
820      * @param env Indicates the environment that the API is invoked under
821      * @param value Indicates a js object to be converted
822      * @param request Indicates a NotificationRequest object from specified js object
823      * @return Returns the null object if success, returns the null value otherwise
824      */
825     static napi_value GetNotificationBasicContent(
826         const napi_env &env, const napi_value &result, NotificationRequest &request);
827 
828     /**
829      * @brief Gets a NotificationBasicContent object from specified js object
830      *
831      * @param env Indicates the environment that the API is invoked under
832      * @param contentResult Indicates a js object to be converted
833      * @param basicContent Indicates a NotificationBasicContent object from specified js object
834      * @return Returns the null object if success, returns the null value otherwise
835      */
836     static napi_value GetNotificationBasicContentDetailed(
837         const napi_env &env, const napi_value &contentResult, std::shared_ptr<NotificationBasicContent> basicContent);
838 
839     /**
840      * @brief Gets a long-text content of NotificationRequest object from specified js object
841      *
842      * @param env Indicates the environment that the API is invoked under
843      * @param value Indicates a js object to be converted
844      * @param request Indicates a NotificationRequest object from specified js object
845      * @return Returns the null object if success, returns the null value otherwise
846      */
847     static napi_value GetNotificationLongTextContent(
848         const napi_env &env, const napi_value &result, NotificationRequest &request);
849 
850     /**
851      * @brief Gets a NotificationLongTextContent object from specified js object
852      *
853      * @param env Indicates the environment that the API is invoked under
854      * @param contentResult Indicates a js object to be converted
855      * @param longContent Indicates a NotificationLongTextContent object from specified js object
856      * @return Returns the null object if success, returns the null value otherwise
857      */
858     static napi_value GetNotificationLongTextContentDetailed(
859         const napi_env &env, const napi_value &contentResult,
860         std::shared_ptr<OHOS::Notification::NotificationLongTextContent> &longContent);
861 
862     /**
863      * @brief Gets a picture content of NotificationRequest object from specified js object
864      *
865      * @param env Indicates the environment that the API is invoked under
866      * @param result Indicates a js object to be converted
867      * @param request Indicates a NotificationRequest object from specified js object
868      * @return Returns the null object if success, returns the null value otherwise
869      */
870     static napi_value GetNotificationPictureContent(
871         const napi_env &env, const napi_value &result, NotificationRequest &request);
872 
873     /**
874      * @brief Gets a NotificationPictureContent object from specified js object
875      *
876      * @param env Indicates the environment that the API is invoked under
877      * @param contentResult Indicates a js object to be converted
878      * @param pictureContent Indicates a NotificationPictureContent object from specified js object
879      * @return Returns the null object if success, returns the null value otherwise
880      */
881     static napi_value GetNotificationPictureContentDetailed(
882         const napi_env &env, const napi_value &contentResult,
883         std::shared_ptr<OHOS::Notification::NotificationPictureContent> &pictureContent);
884 
885     /**
886      * @brief Gets a NotificationLocalLiveViewContent object from specified js object
887      *
888      * @param env Indicates the environment that the API is invoked under
889      * @param result Indicates a js object to be converted
890      * @param request Indicates a NotificationLocalLiveViewContent object from specified js object
891      * @return Returns the null object if success, returns the null value otherwise
892      */
893     static napi_value GetNotificationLocalLiveViewContent(
894         const napi_env &env, const napi_value &result, NotificationRequest &request);
895 
896     /**
897      * @brief Gets a capsule of NotificationLocalLiveViewContent object from specified js object
898      *
899      * @param env Indicates the environment that the API is invoked under
900      * @param contentResult Indicates a js object to be converted
901      * @param content Indicates a capsule object from specified js object
902      * @return Returns the null object if success, returns the null value otherwise
903      */
904     static napi_value GetNotificationLocalLiveViewCapsule(
905         const napi_env &env, const napi_value &contentResult,
906         std::shared_ptr<OHOS::Notification::NotificationLocalLiveViewContent> content);
907 
908     /**
909      * @brief Gets a button of NotificationLocalLiveViewContent object from specified js object
910      *
911      * @param env Indicates the environment that the API is invoked under
912      * @param contentResult Indicates a js object to be converted
913      * @param content Indicates a button object from specified js object
914      * @return Returns the null object if success, returns the null value otherwise
915      */
916     static napi_value GetNotificationLocalLiveViewButton(
917         const napi_env &env, const napi_value &contentResult,
918         std::shared_ptr<OHOS::Notification::NotificationLocalLiveViewContent> content);
919 
920     /**
921      * @brief Gets a time of NotificationLocalLiveViewContent object from specified js object
922      *
923      * @param env Indicates the environment that the API is invoked under
924      * @param contentResult Indicates a js object to be converted
925      * @param content Indicates a time object from specified js object
926      * @return Returns the null object if success, returns the null value otherwise
927      */
928     static napi_value GetNotificationLocalLiveViewTime(
929         const napi_env &env, const napi_value &contentResult,
930         std::shared_ptr<OHOS::Notification::NotificationLocalLiveViewContent> content);
931 
932     /**
933      * @brief Gets a progress of NotificationLocalLiveViewContent object from specified js object
934      *
935      * @param env Indicates the environment that the API is invoked under
936      * @param contentResult Indicates a js object to be converted
937      * @param content Indicates a progress object from specified js object
938      * @return Returns the null object if success, returns the null value otherwise
939      */
940     static napi_value GetNotificationLocalLiveViewProgress(
941         const napi_env &env, const napi_value &contentResult,
942         std::shared_ptr<OHOS::Notification::NotificationLocalLiveViewContent> content);
943 
944     /**
945      * @brief Gets a NotificationLocalLiveViewContent object from specified js object
946      *
947      * @param env Indicates the environment that the API is invoked under
948      * @param contentResult Indicates a js object to be converted
949      * @param content Indicates a NotificationLocalLiveViewContent object from specified js object
950      * @return Returns the null object if success, returns the null value otherwise
951      */
952     static napi_value GetNotificationLocalLiveViewContentDetailed(
953         const napi_env &env, const napi_value &contentResult,
954         std::shared_ptr<OHOS::Notification::NotificationLocalLiveViewContent> content);
955 
956     /**
957      * @brief Gets a conversational content of NotificationRequest object from specified js object
958      *
959      * @param env Indicates the environment that the API is invoked under
960      * @param result Indicates a js object to be converted
961      * @param request Indicates a NotificationRequest object from specified js object
962      * @return Returns the null object if success, returns the null value otherwise
963      */
964     static napi_value GetNotificationConversationalContent(
965         const napi_env &env, const napi_value &result, NotificationRequest &request);
966 
967     /**
968      * @brief Gets the user of NotificationConversationalContent object from specified js object
969      *
970      * @param env Indicates the environment that the API is invoked under
971      * @param contentResult Indicates a js object to be converted
972      * @param user Indicates a MessageUser object from specified js object
973      * @return Returns the null object if success, returns the null value otherwise
974      */
975     static napi_value GetNotificationConversationalContentByUser(
976         const napi_env &env, const napi_value &contentResult, MessageUser &user);
977 
978     /**
979      * @brief Gets the title of NotificationConversationalContent object from specified js object
980      *
981      * @param env Indicates the environment that the API is invoked under
982      * @param contentResult Indicates a js object to be converted
983      * @param conversationalContent Indicates a NotificationConversationalContent object from specified js object
984      * @return Returns the null object if success, returns the null value otherwise
985      */
986     static napi_value GetNotificationConversationalContentTitle(
987         const napi_env &env, const napi_value &contentResult,
988         std::shared_ptr<OHOS::Notification::NotificationConversationalContent> &conversationalContent);
989 
990     /**
991      * @brief Gets the group of NotificationConversationalContent object from specified js object
992      *
993      * @param env Indicates the environment that the API is invoked under
994      * @param contentResult Indicates a js object to be converted
995      * @param conversationalContent Indicates a NotificationConversationalContent object from specified js object
996      * @return Returns the null object if success, returns the null value otherwise
997      */
998     static napi_value GetNotificationConversationalContentGroup(
999         const napi_env &env, const napi_value &contentResult,
1000         std::shared_ptr<OHOS::Notification::NotificationConversationalContent> &conversationalContent);
1001 
1002     /**
1003      * @brief Gets the messages of NotificationConversationalContent object from specified js object
1004      *
1005      * @param env Indicates the environment that the API is invoked under
1006      * @param contentResult Indicates a js object to be converted
1007      * @param conversationalContent Indicates a NotificationConversationalContent object from specified js object
1008      * @return Returns the null object if success, returns the null value otherwise
1009      */
1010     static napi_value GetNotificationConversationalContentMessages(
1011         const napi_env &env, const napi_value &contentResult,
1012         std::shared_ptr<OHOS::Notification::NotificationConversationalContent> &conversationalContent);
1013 
1014     /**
1015      * @brief Gets a NotificationConversationalMessage object from specified js object
1016      *
1017      * @param env Indicates the environment that the API is invoked under
1018      * @param conversationalMessage Indicates a js object to be converted
1019      * @param message Indicates a NotificationConversationalMessage object from specified js object
1020      * @return Returns the null object if success, returns the null value otherwise
1021      */
1022     static napi_value GetConversationalMessage(
1023         const napi_env &env, const napi_value &conversationalMessage,
1024         std::shared_ptr<NotificationConversationalMessage> &message);
1025 
1026     /**
1027      * @brief Gets the basic information of NotificationConversationalMessage object from specified js object
1028      *
1029      * @param env Indicates the environment that the API is invoked under
1030      * @param conversationalMessage Indicates a js object to be converted
1031      * @param message Indicates a NotificationConversationalMessage object from specified js object
1032      * @return Returns the null object if success, returns the null value otherwise
1033      */
1034     static napi_value GetConversationalMessageBasicInfo(
1035         const napi_env &env, const napi_value &conversationalMessage,
1036         std::shared_ptr<NotificationConversationalMessage> &message);
1037 
1038     /**
1039      * @brief Gets the other information of NotificationConversationalMessage object from specified js object
1040      *
1041      * @param env Indicates the environment that the API is invoked under
1042      * @param conversationalMessage Indicates a js object to be converted
1043      * @param message Indicates a NotificationConversationalMessage object from specified js object
1044      * @return Returns the null object if success, returns the null value otherwise
1045      */
1046     static napi_value GetConversationalMessageOtherInfo(
1047         const napi_env &env, const napi_value &conversationalMessage,
1048         std::shared_ptr<NotificationConversationalMessage> &message);
1049 
1050     /**
1051      * @brief Gets a MessageUser object from specified js object
1052      *
1053      * @param env Indicates the environment that the API is invoked under
1054      * @param result Indicates a js object to be converted
1055      * @param messageUser Indicates a MessageUser object from specified js object
1056      * @return Returns the null object if success, returns the null value otherwise
1057      */
1058     static napi_value GetMessageUser(const napi_env &env, const napi_value &result, MessageUser &messageUser);
1059 
1060     /**
1061      * @brief Gets a MessageUser object from specified js object
1062      *
1063      * @param env Indicates the environment that the API is invoked under
1064      * @param result Indicates a js object to be converted
1065      * @param messageUser Indicates a MessageUser object from specified js object
1066      * @return Returns the null object if success, returns the null value otherwise
1067      */
1068     static napi_value GetMessageUserByString(const napi_env &env, const napi_value &result, MessageUser &messageUser);
1069 
1070     /**
1071      * @brief Gets the bool objects of MessageUser object from specified js object
1072      *
1073      * @param env Indicates the environment that the API is invoked under
1074      * @param result Indicates a js object to be converted
1075      * @param messageUser Indicates a MessageUser object from specified js object
1076      * @return Returns the null object if success, returns the null value otherwise
1077      */
1078     static napi_value GetMessageUserByBool(const napi_env &env, const napi_value &result, MessageUser &messageUser);
1079 
1080     /**
1081      * @brief Gets the custom objects of MessageUser object from specified js object
1082      *
1083      * @param env Indicates the environment that the API is invoked under
1084      * @param result Indicates a js object to be converted
1085      * @param messageUser Indicates a MessageUser object from specified js object
1086      * @return Returns the null object if success, returns the null value otherwise
1087      */
1088     static napi_value GetMessageUserByCustom(const napi_env &env, const napi_value &result, MessageUser &messageUser);
1089 
1090     /**
1091      * @brief Gets the multi-line content of NotificationRequest object from specified js object
1092      *
1093      * @param env Indicates the environment that the API is invoked under
1094      * @param result Indicates a js object to be converted
1095      * @param request Indicates a NotificationRequest object from specified js object
1096      * @return Returns the null object if success, returns the null value otherwise
1097      */
1098     static napi_value GetNotificationMultiLineContent(
1099         const napi_env &env, const napi_value &result, NotificationRequest &request);
1100 
1101     /**
1102      * @brief Gets the lines of NotificationMultiLineContent object from specified js object
1103      *
1104      * @param env Indicates the environment that the API is invoked under
1105      * @param result Indicates a js object to be converted
1106      * @param multiLineContent Indicates a NotificationMultiLineContent object from specified js object
1107      * @return Returns the null object if success, returns the null value otherwise
1108      */
1109     static napi_value GetNotificationMultiLineContentLines(const napi_env &env, const napi_value &result,
1110         std::shared_ptr<OHOS::Notification::NotificationMultiLineContent> &multiLineContent);
1111 
1112     /**
1113      * @brief Gets the liveView content of NotificationRequest object from specified js object
1114      *
1115      * @param env Indicates the environment that the API is invoked under
1116      * @param result Indicates a js object to be converted
1117      * @param request Indicates a NotificationRequest object from specified js object
1118      * @return Returns the null object if success, returns the null value otherwise
1119      */
1120     static napi_value GetNotificationLiveViewContent(
1121         const napi_env &env, const napi_value &result, NotificationRequest &request);
1122 
1123     /**
1124      * @brief Gets a NotificationLiveViewContent object from specified js object
1125      *
1126      * @param env Indicates the environment that the API is invoked under
1127      * @param contentResult Indicates a js object to be converted
1128      * @param liveViewContent Indicates a NotificationMultiLineContent object from specified js object
1129      * @return Returns the null object if success, returns the null value otherwise
1130      */
1131     static napi_value GetNotificationLiveViewContentDetailed(const napi_env &env, const napi_value &contentResult,
1132         std::shared_ptr<NotificationLiveViewContent> &liveViewContent);
1133 
1134     /**
1135      * @brief Gets a GetLiveViewPictures from specified js object
1136      *
1137      * @param env Indicates the environment that the API is invoked under
1138      * @param picturesObj Indicates a js object to be converted
1139      * @param pictures Indicates pictures object from specified js object
1140      * @return Returns the null object if success, returns the null value otherwise
1141      */
1142     static napi_value GetLiveViewPictures(const napi_env &env, const napi_value &picturesObj,
1143         std::vector<std::shared_ptr<Media::PixelMap>> &pictures);
1144 
1145     /**
1146      * @brief Gets a GetLiveViewPictures from specified js object
1147      *
1148      * @param env Indicates the environment that the API is invoked under
1149      * @param pictureMapObj Indicates a js object to be converted
1150      * @param pictureMap Indicates picturemap from specified js object
1151      * @return Returns the null object if success, returns the null value otherwise
1152      */
1153     static napi_value GetLiveViewPictureInfo(const napi_env &env, const napi_value &pictureMapObj,
1154         std::map<std::string, std::vector<std::shared_ptr<Media::PixelMap>>> &pictureMap);
1155 
1156     /**
1157      * @brief Gets a NotificationBundleOption object from specified js object
1158      *
1159      * @param env Indicates the environment that the API is invoked under
1160      * @param value Indicates a js object to be converted
1161      * @param option Indicates a NotificationBundleOption object from specified js object
1162      * @return Returns the null object if success, returns the null value otherwise
1163      */
1164     static napi_value GetBundleOption(const napi_env &env, const napi_value &value, NotificationBundleOption &option);
1165 
1166     /**
1167      * @brief Gets a NotificationButtonOption object from specified js object
1168      *
1169      * @param env Indicates the environment that the API is invoked under
1170      * @param value Indicates a js object to be converted
1171      * @param option Indicates a NotificationButtonOption object from specified js object
1172      * @return Returns the null object if success, returns the null value otherwise
1173      */
1174     static napi_value GetButtonOption(const napi_env &env, const napi_value &value, NotificationButtonOption &option);
1175 
1176     static napi_value GetHashCodes(const napi_env &env, const napi_value &value, std::vector<std::string> &hashCodes);
1177 
1178     /**
1179      * @brief Gets a NotificationKey object from specified js object
1180      *
1181      * @param env Indicates the environment that the API is invoked under
1182      * @param value Indicates a js object to be converted
1183      * @param key Indicates a NotificationKey object from specified js object
1184      * @return Returns the null object if success, returns the null value otherwise
1185      */
1186     static napi_value GetNotificationKey(const napi_env &env, const napi_value &value, NotificationKey &key);
1187 
1188     /**
1189      * @brief Gets the template of NotificationRequest object from specified js object
1190      *
1191      * @param env Indicates the environment that the API is invoked under
1192      * @param value Indicates a js object to be converted
1193      * @param request Indicates a NotificationRequest object from specified js object
1194      * @return Returns the null object if success, returns the null value otherwise
1195      */
1196     static napi_value GetNotificationTemplate(
1197         const napi_env &env, const napi_value &value, NotificationRequest &request);
1198 
1199     /**
1200      * @brief Gets a NotificationTemplate object from specified js object
1201      *
1202      * @param env Indicates the environment that the API is invoked under
1203      * @param value Indicates a js object to be converted
1204      * @param templ Indicates a NotificationTemplate object from specified js object
1205      * @return Returns the null object if success, returns the null value otherwise
1206      */
1207     static napi_value GetNotificationTemplateInfo(const napi_env &env, const napi_value &value,
1208         std::shared_ptr<NotificationTemplate> &templ);
1209 
1210     /**
1211      * @brief Gets the number of badge of NotificationRequest object from specified js object
1212      *
1213      * @param env Indicates the environment that the API is invoked under
1214      * @param value Indicates a js object to be converted
1215      * @param request Indicates a NotificationRequest object from specified js object
1216      * @return Returns the null object if success, returns the null value otherwise
1217      */
1218     static napi_value GetNotificationBadgeNumber(
1219         const napi_env &env, const napi_value &value, NotificationRequest &request);
1220 
1221     /**
1222      * @brief Gets a NotificationUnifiedGroupInfo object from specified js object
1223      *
1224      * @param env Indicates the environment that the API is invoked under
1225      * @param value Indicates a js object to be converted
1226      * @param templ Indicates a NotificationUnifiedGroupInfo object from specified js object
1227      * @return Returns the null object if success, returns the null value otherwise
1228      */
1229     static napi_value GetNotificationUnifiedGroupInfo(
1230         const napi_env &env, const napi_value &value, NotificationRequest &request);
1231 
1232     /**
1233      * @brief Gets the notification control flags of NotificationRequest object from specified js object.
1234      *
1235      * @param env Indicates the environment that the API is invoked under
1236      * @param value Indicates a js object to be converted
1237      * @param request Indicates a NotificationRequest object from specified js object
1238      * @return Returns the null object if success, returns the null value otherwise
1239      */
1240     static napi_value GetNotificationControlFlags(
1241         const napi_env &env, const napi_value &value, NotificationRequest &request);
1242 
1243     /**
1244      * @brief Create a napi value with specified error object for callback
1245      *
1246      * @param env Indicates the environment that the API is invoked under
1247      * @param errCode Indicates specified err code
1248      * @return Returns a napi value with specified error object for callback
1249      */
1250     static napi_value CreateErrorValue(napi_env env, int32_t errCode, bool newType);
1251 
1252     /**
1253      * @brief Gets the notificationBundleOption of NotificationRequest object from specified js object
1254      *
1255      * @param env Indicates the environment that the API is invoked under
1256      * @param value Indicates a js object to be converted
1257      * @param request Indicates a NotificationRequest object from specified js object
1258      * @return Returns the null object if success, returns the null value otherwise
1259      */
1260     static napi_value GetNotificationBundleOption(
1261         const napi_env &env, const napi_value &value, NotificationRequest &request);
1262     static bool IsValidRemoveReason(int32_t reasonType);
1263     static void NapiThrow(napi_env env, int32_t errCode);
1264     static napi_value GetLockScreenPicture(
1265         const napi_env &env, const napi_value &contentResult, std::shared_ptr<NotificationBasicContent> basicContent);
1266 
1267 private:
1268     static const int32_t ARGS_ONE = 1;
1269     static const int32_t ARGS_TWO = 2;
1270     static const int32_t ONLY_CALLBACK_MAX_PARA = 1;
1271     static const int32_t ONLY_CALLBACK_MIN_PARA = 0;
1272     static std::set<std::shared_ptr<AbilityRuntime::WantAgent::WantAgent>> wantAgent_;
1273     static std::mutex mutex_;
1274     static const char *GetPropertyNameByContentType(ContentType type);
1275 };
1276 }  // namespace Location
1277 }  // namespace OHOS
1278 
1279 #endif  // BASE_LOCATION_DISTRIBUTED_NOTIFICATION_SERVICE_FRAMEWORKS_JS_NAPI_INCLUDE_COMMON_H
1280