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 #ifndef BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_FRAMEWORKS_JS_NAPI_CANCEL_H 17 #define BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_FRAMEWORKS_JS_NAPI_CANCEL_H 18 19 #include "common.h" 20 21 namespace OHOS { 22 namespace NotificationNapi { 23 using namespace OHOS::Notification; 24 25 struct ParametersInfoCancel { 26 int32_t id = 0; 27 std::string label = ""; 28 napi_ref callback = nullptr; 29 }; 30 31 struct AsyncCallbackInfoCancel { 32 napi_env env = nullptr; 33 napi_async_work asyncWork = nullptr; 34 int32_t id = 0; 35 std::string label; 36 CallbackPromiseInfo info; 37 }; 38 39 struct ParametersInfoCancelGroup { 40 std::string groupName = ""; 41 napi_ref callback = nullptr; 42 }; 43 44 struct AsyncCallbackInfoCancelGroup { 45 napi_env env = nullptr; 46 napi_async_work asyncWork = nullptr; 47 CallbackPromiseInfo info; 48 ParametersInfoCancelGroup params {}; 49 }; 50 51 struct ParametersInfoCancelAsBundle { 52 int32_t id = 0; 53 std::string representativeBundle = ""; 54 int32_t userId = 0; 55 napi_ref callback = nullptr; 56 }; 57 58 struct AsyncCallbackInfoCancelAsBundle { 59 napi_env env = nullptr; 60 napi_async_work asyncWork = nullptr; 61 int32_t id = 0; 62 std::string representativeBundle = ""; 63 int32_t userId = 0; 64 CallbackPromiseInfo info; 65 }; 66 67 napi_value Cancel(napi_env env, napi_callback_info info); 68 napi_value CancelAll(napi_env env, napi_callback_info info); 69 napi_value CancelGroup(napi_env env, napi_callback_info info); 70 napi_value CancelAsBundle(napi_env env, napi_callback_info info); 71 72 napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, ParametersInfoCancelAsBundle ¶s); 73 napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, ParametersInfoCancelGroup ¶s); 74 napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, ParametersInfoCancel ¶s); 75 } // namespace NotificationNapi 76 } // namespace OHOS 77 78 #endif // BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_FRAMEWORKS_JS_NAPI_CANCEL_H