1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OS_ACCOUNT_INTERFACES_KITS_NAPI_DOMAIN_ACCOUNT_INCLUDE_NAPI_DOMAIN_SERVER_MANAGER_H 17 #define OS_ACCOUNT_INTERFACES_KITS_NAPI_DOMAIN_ACCOUNT_INCLUDE_NAPI_DOMAIN_SERVER_MANAGER_H 18 19 #include "domain_account_common.h" 20 #include "napi/native_api.h" 21 #include "napi_account_common.h" 22 23 namespace OHOS { 24 namespace AccountJsKit { 25 struct AddServerConfigAsyncContext : public CommonAsyncContext { AddServerConfigAsyncContextAddServerConfigAsyncContext26 AddServerConfigAsyncContext(napi_env napiEnv) : CommonAsyncContext(napiEnv) {}; 27 AccountSA::DomainServerConfig domainServerConfig; 28 std::string parameters; 29 }; 30 31 struct GetAccountServerConfigAsyncContext : public CommonAsyncContext { GetAccountServerConfigAsyncContextGetAccountServerConfigAsyncContext32 GetAccountServerConfigAsyncContext(napi_env napiEnv) : CommonAsyncContext(napiEnv) {}; 33 AccountSA::DomainAccountInfo domainAccountInfo; 34 AccountSA::DomainServerConfig domainServerConfig; 35 }; 36 37 struct RemoveServerConfigAsyncContext : public CommonAsyncContext { RemoveServerConfigAsyncContextRemoveServerConfigAsyncContext38 RemoveServerConfigAsyncContext(napi_env napiEnv) : CommonAsyncContext(napiEnv) {}; 39 std::string configId; 40 }; 41 42 class NapiDomainServerConfigManager { 43 public: 44 static napi_value Init(napi_env env, napi_value exports); 45 46 private: 47 static napi_value JsConstructor(napi_env env, napi_callback_info cbInfo); 48 static napi_value AddServerConfig(napi_env env, napi_callback_info cbInfo); 49 static napi_value RemoveServerConfig(napi_env env, napi_callback_info cbInfo); 50 static napi_value GetAccountServerConfig(napi_env env, napi_callback_info cbInfo); 51 }; 52 } // namespace AccountJsKit 53 } // namespace OHOS 54 #endif // OS_ACCOUNT_INTERFACES_KITS_NAPI_DOMAIN_ACCOUNT_INCLUDE_NAPI_DOMAIN_SERVER_MANAGER_H