Lines Matching refs:env

44  * @param env Conditions for initialize operation
50 void ObjectInit(napi_env env, napi_value object, napi_value &hold, napi_value &attr, napi_value &contact)
52 int type = GetType(env, object);
71 * @param env Conditions for initialize operation
75 void ObjectInitId(napi_env env, napi_value object, napi_value &id)
77 int type = GetType(env, object);
90 * @param env Conditions for initialize operation
94 void ObjectInitString(napi_env env, napi_value object, napi_value &key)
96 int type = GetType(env, object);
109 * @param env Conditions for get type operation
114 int GetType(napi_env env, napi_value value)
117 napi_typeof(env, value, &valueType);
128 napi_create_string_utf8(env, "bundleName", NAPI_AUTO_LENGTH, &key);
129 napi_has_property(env, value, key, &result);
133 napi_create_string_utf8(env, "attributes", NAPI_AUTO_LENGTH, &key);
134 napi_has_property(env, value, key, &result);
149 * @param env Conditions for get dataShareHelper operation
153 bool GetDataShareHelper(napi_env env, napi_callback_info info, ExecuteHelper *executeHelper)
158 napi_status status = napi_get_global(env, &global);
168 status = napi_get_named_property(env, global, "globalThis", &globalThis);
172 status = napi_get_named_property(env, globalThis, "abilityContext", &abilityContext);
176 status = OHOS::AbilityRuntime::IsStageContext(env, abilityContext, isStageMode);
182 auto ability = OHOS::AbilityRuntime::GetCurrentAbility(env);
195 auto context = OHOS::AbilityRuntime::GetStageModeContext(env, abilityContext);
278 * @param env Conditions for resolve object interface operation
281 DataShare::DataSharePredicates BuildDeleteContactPredicates(napi_env env, ExecuteHelper *executeHelper)
285 std::string keyValue = contactsBuild.NapiGetValueString(env, executeHelper->argv[0]);
297 * @param env Conditions for resolve object interface operation
303 napi_env env, napi_value key, napi_value hold, napi_value attr)
306 std::string keyValue = contactsBuild.NapiGetValueString(env, key);
307 Holder holder = contactsBuild.GetHolder(env, hold);
334 * @param env Conditions for resolve object interface operation
338 DataShare::DataSharePredicates BuildQueryContactsPredicates(napi_env env, napi_value hold, napi_value attr)
341 Holder holder = contactsBuild.GetHolder(env, hold);
342 ContactAttributes attrs = contactsBuild.GetContactAttributes(env, attr);
380 * @param env Conditions for resolve object interface operation
386 napi_env env, napi_value emailobject, napi_value hold, napi_value attr)
389 std::string email = contactsBuild.NapiGetValueString(env, emailobject);
390 Holder holder = contactsBuild.GetHolder(env, hold);
406 * @param env Conditions for resolve object interface operation
412 napi_env env, napi_value number, napi_value hold, napi_value attr)
415 std::string phoneNumber = contactsBuild.NapiGetValueString(env, number);
416 Holder holder = contactsBuild.GetHolder(env, hold);
432 * @param env Conditions for resolve object interface operation
435 DataShare::DataSharePredicates BuildQueryGroupsPredicates(napi_env env, napi_value hold)
438 Holder holder = contactsBuild.GetHolder(env, hold);
460 * @param env Conditions for resolve object interface operation
464 DataShare::DataSharePredicates BuildQueryKeyPredicates(napi_env env, napi_value id, napi_value hold)
467 int value = contactsBuild.GetInt(env, id);
468 Holder holder = contactsBuild.GetHolder(env, hold);
482 * @param env Conditions for resolve object interface operation
485 DataShare::DataSharePredicates BuildQueryMyCardPredicates(napi_env env, napi_value attr)
488 ContactAttributes attrs = contactsBuild.GetContactAttributes(env, attr);
504 DataShare::DataSharePredicates BuildQueryContactData(napi_env env, napi_value &contactObject, napi_value &attrObject,
509 contactsBuild.GetContactDataByObject(env, contactObject, contact);
510 ContactAttributes attrs = contactsBuild.GetContactAttributes(env, attrObject);
550 DataShare::DataSharePredicates BuildUpdateContactConvertParams(napi_env env, napi_value &contact,
555 BuildQueryContactData(env, contact, attr, executeHelper->valueContactData);
557 executeHelper->deletePredicates = BuildDeleteContactDataPredicates(env, attr);
561 DataShare::DataSharePredicates BuildDeleteContactDataPredicates(napi_env env, napi_value attr)
564 ContactAttributes attrs = contactsBuild.GetContactAttributes(env, attr);
574 * @param env Conditions for resolve object interface operation
577 DataShare::DataSharePredicates BuildIsLocalContactPredicates(napi_env env, napi_value id)
580 int value = contactsBuild.GetInt(env, id);
597 * @param env Conditions for resolve object interface operation
600 DataShare::DataSharePredicates BuildIsMyCardPredicates(napi_env env, napi_value id)
603 int value = contactsBuild.GetInt(env, id);
613 void ExecuteDone(napi_env env, napi_status status, void *data)
620 HandleExecuteResult(env, executeHelper, result);
624 HandleExecuteErrorCode(env, executeHelper, errorCode);
626 NAPI_CALL_RETURN_VOID(env, napi_reject_deferred(env, deferred, errorCode));
628 NAPI_CALL_RETURN_VOID(env, napi_resolve_deferred(env, deferred, result));
632 NAPI_CALL_RETURN_VOID(env, napi_resolve_deferred(env, deferred, result));
645 NAPI_CALL_RETURN_VOID(env, napi_delete_async_work(env, executeHelper->work));
654 void ExecuteSyncDone(napi_env env, napi_status status, void *data)
665 napi_get_global(env, &global);
668 HandleExecuteErrorCode(env, executeHelper, resultData[0]);
669 HandleExecuteResult(env, executeHelper, resultData[1]);
672 HandleExecuteErrorCode(env, executeHelper, resultData[0]);
673 HandleExecuteResult(env, executeHelper, resultData[1]);
675 napi_get_undefined(env, &resultData[0]);
676 HandleExecuteResult(env, executeHelper, resultData[1]);
682 napi_get_reference_value(env, executeHelper->callBack, &callBack);
684 napi_typeof(env, callBack, &valuetype);
689 napi_call_function(env, global, callBack, RESULT_DATA_SIZE, resultData, &result);
691 napi_delete_async_work(env, executeHelper->work);
714 void HandleExecuteErrorCode(napi_env env, ExecuteHelper *executeHelper, napi_value &result)
736 result = ContactsNapiUtils::CreateError(env, PARAMETER_ERROR);
739 result = ContactsNapiUtils::CreateErrorByVerification(env, PARAMETER_ERROR);
742 result = ContactsNapiUtils::CreateError(env, PERMISSION_ERROR);
750 void HandleExecuteResult(napi_env env, ExecuteHelper *executeHelper, napi_value &result)
760 napi_create_int64(env, ERROR, &result);
762 napi_create_int64(env, executeHelper->resultData, &result);
767 napi_get_boolean(env, executeHelper->resultData != 0, &result);
771 results = resultConvert.ResultSetToObject(env, executeHelper->resultSet);
773 napi_get_element(env, results, 0, &result);
777 results = resultConvert.ResultSetToObject(env, executeHelper->resultSet);
779 napi_get_element(env, results, 0, &result);
781 napi_get_named_property(env, result, "key", &result);
786 result = resultConvert.ResultSetToObject(env, executeHelper->resultSet);
789 result = resultConvert.ResultSetToGroup(env, executeHelper->resultSet);
792 result = resultConvert.ResultSetToHolder(env, executeHelper->resultSet);
799 void LocalExecuteAddContact(napi_env env, ExecuteHelper *executeHelper)
822 void LocalExecuteDeleteContact(napi_env env, ExecuteHelper *executeHelper)
830 void LocalExecuteQueryContact(napi_env env, ExecuteHelper *executeHelper)
838 void LocalExecuteQueryContactsOrKey(napi_env env, ExecuteHelper *executeHelper)
846 void LocalExecuteQueryContactsByData(napi_env env, ExecuteHelper *executeHelper)
862 void LocalExecuteQueryGroup(napi_env env, ExecuteHelper *executeHelper)
870 void LocalExecuteQueryHolders(napi_env env, ExecuteHelper *executeHelper)
878 void LocalExecuteQueryMyCard(napi_env env, ExecuteHelper *executeHelper)
886 void LocalExecuteUpdateContact(napi_env env, ExecuteHelper *executeHelper)
914 void LocalExecuteIsLocalContact(napi_env env, ExecuteHelper *executeHelper)
932 void LocalExecuteIsMyCard(napi_env env, ExecuteHelper *executeHelper)
952 void LocalExecute(napi_env env, ExecuteHelper *executeHelper)
961 LocalExecuteAddContact(env, executeHelper);
964 LocalExecuteDeleteContact(env, executeHelper);
967 LocalExecuteUpdateContact(env, executeHelper);
970 LocalExecuteSplit(env, executeHelper);
976 void LocalExecuteSplit(napi_env env, ExecuteHelper *executeHelper)
989 LocalExecuteQueryContact(env, executeHelper);
992 LocalExecuteQueryContactsOrKey(env, executeHelper);
996 LocalExecuteQueryContactsByData(env, executeHelper);
999 LocalExecuteQueryGroup(env, executeHelper);
1002 LocalExecuteQueryHolders(env, executeHelper);
1005 LocalExecuteQueryContactsOrKey(env, executeHelper);
1008 LocalExecuteQueryMyCard(env, executeHelper);
1011 LocalExecuteIsLocalContact(env, executeHelper);
1014 LocalExecuteIsMyCard(env, executeHelper);
1022 void Execute(napi_env env, void *data)
1026 LocalExecute(env, executeHelper);
1029 napi_value CreateAsyncWork(napi_env env, ExecuteHelper *executeHelper)
1034 napi_create_string_latin1(env, __func__, NAPI_AUTO_LENGTH, &workName);
1035 napi_create_reference(env, executeHelper->argv[executeHelper->argc - 1], 1, &executeHelper->callBack);
1036 napi_create_async_work(env, nullptr, workName, Execute, ExecuteSyncDone,
1038 napi_get_null(env, &result);
1040 napi_create_string_latin1(env, __func__, NAPI_AUTO_LENGTH, &workName);
1041 napi_create_promise(env, &(executeHelper->deferred), &result);
1042 napi_create_async_work(env, nullptr, workName, Execute, ExecuteDone,
1045 napi_queue_async_work(env, executeHelper->work);
1050 DataShare::DataSharePredicates ConvertParamsSwitchSplit(int code, napi_env env, const napi_value &key,
1056 VerificationParameterHolderId(env, executeHelper, hold);
1057 predicates = BuildQueryContactPredicates(env, key, hold, attr);
1060 VerificationParameterHolderId(env, executeHelper, hold);
1061 predicates = BuildQueryContactsPredicates(env, hold, attr);
1064 VerificationParameterHolderId(env, executeHelper, hold);
1065 predicates = BuildQueryContactsByEmailPredicates(env, key, hold, attr);
1068 VerificationParameterHolderId(env, executeHelper, hold);
1069 predicates = BuildQueryContactsByPhoneNumberPredicates(env, key, hold, attr);
1072 VerificationParameterHolderId(env, executeHelper, hold);
1073 predicates = BuildQueryGroupsPredicates(env, hold);
1078 predicates = BuildQueryMyCardPredicates(env, attr);
1087 void SetChildActionCodeAndConvertParams(napi_env env, ExecuteHelper *executeHelper)
1096 ObjectInitId(env, executeHelper->argv[i], id);
1097 ObjectInitString(env, executeHelper->argv[i], key);
1098 ObjectInit(env, executeHelper->argv[i], hold, attr, contact);
1104 env, executeHelper->argv[0], executeHelper->valueContact, executeHelper->valueContactData);
1107 executeHelper->predicates = BuildDeleteContactPredicates(env, executeHelper);
1110 executeHelper->predicates = BuildUpdateContactConvertParams(env, contact, attr, executeHelper);
1113 VerificationParameterId(env, id, executeHelper, hold);
1114 executeHelper->predicates = BuildIsLocalContactPredicates(env, id);
1117 VerificationParameterId(env, id, executeHelper, hold);
1118 executeHelper->predicates = BuildIsMyCardPredicates(env, id);
1121 VerificationParameterId(env, id, executeHelper, hold);
1122 executeHelper->predicates = BuildQueryKeyPredicates(env, id, hold);
1125 executeHelper->predicates = ConvertParamsSwitchSplit(executeHelper->actionCode, env, key, hold,
1131 void VerificationParameterId(napi_env env, napi_value id, ExecuteHelper *executeHelper, napi_value hold)
1134 Holder holder = contactsBuild.GetHolder(env, hold);
1136 int valueId = contactsBuild.GetInt(env, id);
1146 void VerificationParameterHolderId(napi_env env, ExecuteHelper *executeHelper, napi_value hold)
1149 Holder holder = contactsBuild.GetHolder(env, hold);
1157 napi_value Scheduling(napi_env env, napi_callback_info info, ExecuteHelper *executeHelper, int actionCode)
1161 napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
1167 napi_typeof(env, argv[argc - 1], &valuetype);
1176 OHOS::AbilityRuntime::IsStageContext(env, argv[0], isStageMode);
1191 SetChildActionCodeAndConvertParams(env, executeHelper);
1192 GetDataShareHelper(env, info, executeHelper);
1194 napi_value result = CreateAsyncWork(env, executeHelper);
1201 * @param env Conditions for resolve object interface operation
1206 napi_value AddContact(napi_env env, napi_callback_info info)
1212 napi_get_cb_info(env, info, &argc, argv, &thisVar, &data);
1214 OHOS::AbilityRuntime::IsStageContext(env, argv[0], isStageMode);
1216 napi_value errorCode = ContactsNapiUtils::CreateError(env, PARAMETER_ERROR);
1219 if (!ContactsNapiUtils::MatchParameters(env, argv, { napi_object, napi_object })) {
1220 napi_throw(env, errorCode);
1224 if (!ContactsNapiUtils::MatchParameters(env, argv, { napi_object, napi_object, napi_function })) {
1225 napi_throw(env, errorCode);
1229 napi_throw(env, errorCode);
1236 result = Scheduling(env, info, executeHelper, ADD_CONTACT);
1239 napi_create_int64(env, ERROR, &result);
1246 * @param env Conditions for resolve object interface operation
1251 napi_value DeleteContact(napi_env env, napi_callback_info info)
1257 napi_get_cb_info(env, info, &argc, argv, &thisVar, &data);
1259 OHOS::AbilityRuntime::IsStageContext(env, argv[0], isStageMode);
1261 napi_value errorCode = ContactsNapiUtils::CreateError(env, PARAMETER_ERROR);
1264 if (!ContactsNapiUtils::MatchParameters(env, argv, { napi_object, napi_string })) {
1265 napi_throw(env, errorCode);
1269 if (!ContactsNapiUtils::MatchParameters(env, argv, { napi_object, napi_string, napi_function })) {
1270 napi_throw(env, errorCode);
1274 napi_throw(env, errorCode);
1281 result = Scheduling(env, info, executeHelper, DELETE_CONTACT);
1284 napi_create_int64(env, ERROR, &result);
1291 * @param env Conditions for resolve object interface operation
1296 napi_value UpdateContact(napi_env env, napi_callback_info info)
1302 napi_get_cb_info(env, info, &argc, argv, &thisVar, &data);
1304 OHOS::AbilityRuntime::IsStageContext(env, argv[0], isStageMode);
1306 napi_value errorCode = ContactsNapiUtils::CreateError(env, PARAMETER_ERROR);
1309 if (!ContactsNapiUtils::MatchParameters(env, argv, { napi_object, napi_object })) {
1310 napi_throw(env, errorCode);
1314 if (!ContactsNapiUtils::MatchParameters(env, argv, { napi_object, napi_object, napi_function })
1315 && !ContactsNapiUtils::MatchParameters(env, argv, { napi_object, napi_object, napi_object })) {
1316 napi_throw(env, errorCode);
1320 if (!ContactsNapiUtils::MatchParameters(env, argv,
1322 napi_throw(env, errorCode);
1326 napi_throw(env, errorCode);
1333 result = Scheduling(env, info, executeHelper, UPDATE_CONTACT);
1336 napi_create_int64(env, ERROR, &result);
1343 * @param env Conditions for resolve object interface operation
1348 napi_value QueryContact(napi_env env, napi_callback_info info)
1354 napi_get_cb_info(env, info, &argc, argv, &thisVar, &data);
1356 OHOS::AbilityRuntime::IsStageContext(env, argv[0], isStageMode);
1358 napi_value errorCode = ContactsNapiUtils::CreateError(env, PARAMETER_ERROR);
1361 if (!ContactsNapiUtils::MatchParameters(env, argv, { napi_object, napi_string })) {
1362 napi_throw(env, errorCode);
1366 if (!ContactsNapiUtils::MatchParameters(env, argv, { napi_object, napi_string, napi_function })) {
1367 napi_throw(env, errorCode);
1371 if (!ContactsNapiUtils::MatchParameters(env, argv,
1373 !ContactsNapiUtils::MatchParameters(env, argv,
1375 napi_throw(env, errorCode);
1379 if (!ContactsNapiUtils::MatchParameters(env, argv,
1383 napi_throw(env, errorCode);
1387 napi_throw(env, errorCode);
1394 result = Scheduling(env, info, executeHelper, QUERY_CONTACT);
1397 napi_create_int64(env, ERROR, &result);
1404 * @param env Conditions for resolve object interface operation
1409 napi_value QueryContacts(napi_env env, napi_callback_info info)
1415 napi_get_cb_info(env, info, &argc, argv, &thisVar, &data);
1417 OHOS::AbilityRuntime::IsStageContext(env, argv[0], isStageMode);
1419 napi_value errorCode = ContactsNapiUtils::CreateError(env, PARAMETER_ERROR);
1422 if (!ContactsNapiUtils::MatchParameters(env, argv, { napi_object })) {
1423 napi_throw(env, errorCode);
1427 if (!ContactsNapiUtils::MatchParameters(env, argv, { napi_object, napi_function })) {
1428 napi_throw(env, errorCode);
1432 if (!ContactsNapiUtils::MatchParameters(env, argv, { napi_object, napi_object, napi_function })
1433 && !ContactsNapiUtils::MatchParameters(env, argv, { napi_object, napi_object, napi_object })
1435 napi_throw(env, errorCode);
1439 if (!ContactsNapiUtils::MatchParameters(env, argv,
1441 napi_throw(env, errorCode);
1445 napi_throw(env, errorCode);
1452 result = Scheduling(env, info, executeHelper, QUERY_CONTACTS);
1455 napi_create_int64(env, ERROR, &result);
1462 * @param env Conditions for resolve object interface operation
1467 napi_value QueryContactsByEmail(napi_env env, napi_callback_info info)
1473 napi_get_cb_info(env, info, &argc, argv, &thisVar, &data);
1475 OHOS::AbilityRuntime::IsStageContext(env, argv[0], isStageMode);
1477 napi_value errorCode = ContactsNapiUtils::CreateError(env, PARAMETER_ERROR);
1480 if (!ContactsNapiUtils::MatchParameters(env, argv, { napi_object, napi_string })) {
1481 napi_throw(env, errorCode);
1485 if (!ContactsNapiUtils::MatchParameters(env, argv, { napi_object, napi_string, napi_function })) {
1486 napi_throw(env, errorCode);
1490 if (!ContactsNapiUtils::MatchParameters(env, argv,
1492 !ContactsNapiUtils::MatchParameters(env, argv,
1494 !ContactsNapiUtils::MatchParameters(env, argv,
1496 napi_throw(env, errorCode);
1500 if (!ContactsNapiUtils::MatchParameters(env, argv,
1504 napi_throw(env, errorCode);
1508 napi_throw(env, errorCode);
1515 result = Scheduling(env, info, executeHelper, QUERY_CONTACTS_BY_EMAIL);
1518 napi_create_int64(env, ERROR, &result);
1525 * @param env Conditions for resolve object interface operation
1530 napi_value QueryContactsByPhoneNumber(napi_env env, napi_callback_info info)
1536 napi_get_cb_info(env, info, &argc, argv, &thisVar, &data);
1538 OHOS::AbilityRuntime::IsStageContext(env, argv[0], isStageMode);
1540 napi_value errorCode = ContactsNapiUtils::CreateError(env, PARAMETER_ERROR);
1543 if (!ContactsNapiUtils::MatchParameters(env, argv, { napi_object, napi_string })) {
1544 napi_throw(env, errorCode);
1548 if (!ContactsNapiUtils::MatchParameters(env, argv, { napi_object, napi_string, napi_function })) {
1549 napi_throw(env, errorCode);
1553 if (!ContactsNapiUtils::MatchParameters(env, argv,
1555 !ContactsNapiUtils::MatchParameters(env, argv,
1557 napi_throw(env, errorCode);
1561 if (!ContactsNapiUtils::MatchParameters(env, argv,
1565 napi_throw(env, errorCode);
1569 napi_throw(env, errorCode);
1576 result = Scheduling(env, info, executeHelper, QUERY_CONTACTS_BY_PHONE_NUMBER);
1579 napi_create_int64(env, ERROR, &result);
1586 * @param env Conditions for resolve object interface operation
1591 napi_value QueryGroups(napi_env env, napi_callback_info info)
1597 napi_get_cb_info(env, info, &argc, argv, &thisVar, &data);
1599 OHOS::AbilityRuntime::IsStageContext(env, argv[0], isStageMode);
1601 napi_value errorCode = ContactsNapiUtils::CreateError(env, PARAMETER_ERROR);
1604 if (!ContactsNapiUtils::MatchParameters(env, argv, { napi_object })) {
1605 napi_throw(env, errorCode);
1609 if (!ContactsNapiUtils::MatchParameters(env, argv, { napi_object, napi_function })
1610 && !ContactsNapiUtils::MatchParameters(env, argv, { napi_object, napi_object })) {
1611 napi_throw(env, errorCode);
1615 if (!ContactsNapiUtils::MatchParameters(env, argv, { napi_object, napi_object, napi_function })) {
1616 napi_throw(env, errorCode);
1620 napi_throw(env, errorCode);
1627 result = Scheduling(env, info, executeHelper, QUERY_GROUPS);
1630 napi_create_int64(env, ERROR, &result);
1637 * @param env Conditions for resolve object interface operation
1642 napi_value QueryHolders(napi_env env, napi_callback_info info)
1648 napi_get_cb_info(env, info, &argc, argv, &thisVar, &data);
1650 OHOS::AbilityRuntime::IsStageContext(env, argv[0], isStageMode);
1652 napi_value errorCode = ContactsNapiUtils::CreateError(env, PARAMETER_ERROR);
1655 if (!ContactsNapiUtils::MatchParameters(env, argv, { napi_object })) {
1656 napi_throw(env, errorCode);
1660 if (!ContactsNapiUtils::MatchParameters(env, argv, { napi_object, napi_function })) {
1661 napi_throw(env, errorCode);
1665 napi_throw(env, errorCode);
1672 result = Scheduling(env, info, executeHelper, QUERY_HOLDERS);
1675 napi_create_int64(env, ERROR, &result);
1682 * @param env Conditions for resolve object interface operation
1687 napi_value QueryKey(napi_env env, napi_callback_info info)
1693 napi_get_cb_info(env, info, &argc, argv, &thisVar, &data);
1695 OHOS::AbilityRuntime::IsStageContext(env, argv[0], isStageMode);
1697 napi_value errorCode = ContactsNapiUtils::CreateError(env, PARAMETER_ERROR);
1700 if (!ContactsNapiUtils::MatchParameters(env, argv, { napi_object })) {
1701 napi_throw(env, errorCode);
1705 if (!ContactsNapiUtils::MatchParameters(env, argv, { napi_object, napi_function })
1706 && !ContactsNapiUtils::MatchParameters(env, argv, { napi_object, napi_number })) {
1707 napi_throw(env, errorCode);
1711 if (!ContactsNapiUtils::MatchParameters(env, argv, { napi_object, napi_number, napi_function })
1712 && !ContactsNapiUtils::MatchParameters(env, argv, { napi_object, napi_number, napi_object })) {
1713 napi_throw(env, errorCode);
1717 if (!ContactsNapiUtils::MatchParameters(env, argv,
1719 napi_throw(env, errorCode);
1723 napi_throw(env, errorCode);
1730 result = Scheduling(env, info, executeHelper, QUERY_KEY);
1733 napi_create_int64(env, ERROR, &result);
1740 * @param env Conditions for resolve object interface operation
1745 napi_value QueryMyCard(napi_env env, napi_callback_info info)
1751 napi_get_cb_info(env, info, &argc, argv, &thisVar, &data);
1753 OHOS::AbilityRuntime::IsStageContext(env, argv[0], isStageMode);
1755 napi_value errorCode = ContactsNapiUtils::CreateError(env, PARAMETER_ERROR);
1758 if (!ContactsNapiUtils::MatchParameters(env, argv, { napi_object })) {
1759 napi_throw(env, errorCode);
1763 if (!ContactsNapiUtils::MatchParameters(env, argv, { napi_object, napi_object })
1764 && !ContactsNapiUtils::MatchParameters(env, argv, { napi_object, napi_function })) {
1765 napi_throw(env, errorCode);
1769 if (!ContactsNapiUtils::MatchParameters(env, argv, { napi_object, napi_object, napi_function })) {
1770 napi_throw(env, errorCode);
1774 napi_throw(env, errorCode);
1781 result = Scheduling(env, info, executeHelper, QUERY_MY_CARD);
1784 napi_create_int64(env, ERROR, &result);
1791 * @param env Conditions for resolve object interface operation
1796 napi_value IsMyCard(napi_env env, napi_callback_info info)
1802 napi_get_cb_info(env, info, &argc, argv, &thisVar, &data);
1804 OHOS::AbilityRuntime::IsStageContext(env, argv[0], isStageMode);
1806 napi_value errorCode = ContactsNapiUtils::CreateError(env, PARAMETER_ERROR);
1809 if (!ContactsNapiUtils::MatchParameters(env, argv, { napi_object, napi_number })) {
1810 napi_throw(env, errorCode);
1814 if (!ContactsNapiUtils::MatchParameters(env, argv, { napi_object, napi_number, napi_function })) {
1815 napi_throw(env, errorCode);
1819 napi_throw(env, errorCode);
1826 result = Scheduling(env, info, executeHelper, IS_MY_CARD);
1829 napi_create_int64(env, ERROR, &result);
1836 * @param env Conditions for resolve object interface operation
1841 napi_value IsLocalContact(napi_env env, napi_callback_info info)
1847 napi_get_cb_info(env, info, &argc, argv, &thisVar, &data);
1849 OHOS::AbilityRuntime::IsStageContext(env, argv[0], isStageMode);
1851 napi_value errorCode = ContactsNapiUtils::CreateError(env, PARAMETER_ERROR);
1854 if (!ContactsNapiUtils::MatchParameters(env, argv, { napi_object, napi_number })) {
1855 napi_throw(env, errorCode);
1859 if (!ContactsNapiUtils::MatchParameters(env, argv, { napi_object, napi_number, napi_function })) {
1860 napi_throw(env, errorCode);
1864 napi_throw(env, errorCode);
1871 result = Scheduling(env, info, executeHelper, IS_LOCAL_CONTACT);
1874 napi_create_int64(env, ERROR, &result);
1878 napi_value DeclareContactConst(napi_env env, napi_value exports)
1883 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Contacts::INVALID_CONTACT_ID))),
1886 napi_define_class(env, "Contact", NAPI_AUTO_LENGTH, ContactsNapiUtils::CreateClassConstructor, nullptr,
1888 napi_set_named_property(env, exports, "Contact", result);
1892 napi_value DeclareEmailConst(napi_env env, napi_value exports)
1897 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Email::CUSTOM_LABEL))),
1899 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Email::EMAIL_HOME))),
1901 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Email::EMAIL_WORK))),
1903 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Email::EMAIL_OTHER))),
1905 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Email::INVALID_LABEL_ID))),
1908 napi_define_class(env, "Email", NAPI_AUTO_LENGTH, ContactsNapiUtils::CreateClassConstructor, nullptr,
1910 napi_set_named_property(env, exports, "Email", result);
1914 napi_value DeclareEventConst(napi_env env, napi_value exports)
1919 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Event::CUSTOM_LABEL))),
1921 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Event::EVENT_ANNIVERSARY))),
1923 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Event::EVENT_OTHER))),
1925 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Event::EVENT_BIRTHDAY))),
1927 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Event::INVALID_LABEL_ID))),
1930 napi_define_class(env, "Event", NAPI_AUTO_LENGTH, ContactsNapiUtils::CreateClassConstructor, nullptr,
1932 napi_set_named_property(env, exports, "Event", result);
1936 napi_value DeclareImAddressConst(napi_env env, napi_value exports)
1941 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(ImAddress::CUSTOM_LABEL))),
1943 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(ImAddress::IM_AIM))),
1945 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(ImAddress::IM_MSN))),
1947 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(ImAddress::IM_YAHOO))),
1949 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(ImAddress::IM_SKYPE))),
1951 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(ImAddress::IM_QQ))),
1953 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(ImAddress::IM_ICQ))),
1955 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(ImAddress::IM_JABBER))),
1957 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(ImAddress::INVALID_LABEL_ID))),
1960 napi_define_class(env, "ImAddress", NAPI_AUTO_LENGTH, ContactsNapiUtils::CreateClassConstructor, nullptr,
1962 napi_set_named_property(env, exports, "ImAddress", result);
1966 napi_value DeclarePhoneNumberConst(napi_env env, napi_value exports)
1971 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(PhoneNumber::CUSTOM_LABEL))),
1973 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(PhoneNumber::NUM_HOME))),
1975 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(PhoneNumber::NUM_MOBILE))),
1977 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(PhoneNumber::NUM_WORK))),
1979 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(PhoneNumber::NUM_FAX_WORK))),
1981 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(PhoneNumber::NUM_FAX_HOME))),
1983 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(PhoneNumber::NUM_PAGER))),
1985 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(PhoneNumber::NUM_OTHER))),
1987 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(PhoneNumber::NUM_CALLBACK))),
1989 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(PhoneNumber::NUM_CAR))),
1991 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(PhoneNumber::NUM_COMPANY_MAIN))),
1993 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(PhoneNumber::NUM_ISDN))),
1995 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(PhoneNumber::NUM_MAIN))),
1997 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(PhoneNumber::NUM_OTHER_FAX))),
1999 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(PhoneNumber::NUM_RADIO))),
2001 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(PhoneNumber::NUM_TELEX))),
2003 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(PhoneNumber::NUM_TTY_TDD))),
2005 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(PhoneNumber::NUM_WORK_MOBILE))),
2007 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(PhoneNumber::NUM_WORK_PAGER))),
2009 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(PhoneNumber::NUM_ASSISTANT))),
2011 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(PhoneNumber::NUM_MMS))),
2013 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(PhoneNumber::INVALID_LABEL_ID))),
2016 napi_define_class(env, "PhoneNumber", NAPI_AUTO_LENGTH, ContactsNapiUtils::CreateClassConstructor, nullptr,
2018 napi_set_named_property(env, exports, "PhoneNumber", result);
2022 napi_value DeclarePostalAddressConst(napi_env env, napi_value exports)
2027 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(PostalAddress::CUSTOM_LABEL))),
2029 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(PostalAddress::ADDR_HOME))),
2031 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(PostalAddress::ADDR_WORK))),
2033 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(PostalAddress::ADDR_OTHER))),
2035 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(PostalAddress::INVALID_LABEL_ID))),
2038 napi_define_class(env, "PostalAddress", NAPI_AUTO_LENGTH, ContactsNapiUtils::CreateClassConstructor, nullptr,
2040 napi_set_named_property(env, exports, "PostalAddress", result);
2044 napi_value DeclareRelationConst(napi_env env, napi_value exports)
2049 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Relation::CUSTOM_LABEL))),
2051 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Relation::RELATION_ASSISTANT))),
2053 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Relation::RELATION_BROTHER))),
2055 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Relation::RELATION_CHILD))),
2057 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Relation::RELATION_DOMESTIC_PARTNER))),
2059 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Relation::RELATION_FATHER))),
2061 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Relation::RELATION_FRIEND))),
2063 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Relation::RELATION_MANAGER))),
2065 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Relation::RELATION_MOTHER))),
2067 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Relation::RELATION_PARENT))),
2069 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Relation::RELATION_PARTNER))),
2071 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Relation::RELATION_REFERRED_BY))),
2073 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Relation::RELATION_RELATIVE))),
2075 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Relation::RELATION_SISTER))),
2077 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Relation::RELATION_SPOUSE))),
2079 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Relation::INVALID_LABEL_ID))),
2082 napi_define_class(env, "Relation", NAPI_AUTO_LENGTH, ContactsNapiUtils::CreateClassConstructor, nullptr,
2084 napi_set_named_property(env, exports, "Relation", result);
2088 napi_value DeclareSipAddressConst(napi_env env, napi_value exports)
2093 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(SipAddress::CUSTOM_LABEL))),
2095 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(SipAddress::SIP_HOME))),
2097 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(SipAddress::SIP_WORK))),
2099 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(SipAddress::SIP_OTHER))),
2101 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(SipAddress::INVALID_LABEL_ID))),
2104 napi_define_class(env, "SipAddress", NAPI_AUTO_LENGTH, ContactsNapiUtils::CreateClassConstructor, nullptr,
2106 napi_set_named_property(env, exports, "SipAddress", result);
2110 napi_value DeclareAttributeConst(napi_env env, napi_value exports)
2115 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Attribute::ATTR_CONTACT_EVENT))),
2117 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Attribute::ATTR_EMAIL))),
2119 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Attribute::ATTR_GROUP_MEMBERSHIP))),
2121 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Attribute::ATTR_IM))),
2123 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Attribute::ATTR_NAME))),
2125 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Attribute::ATTR_NICKNAME))),
2127 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Attribute::ATTR_NOTE))),
2129 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Attribute::ATTR_ORGANIZATION))),
2131 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Attribute::ATTR_PHONE))),
2133 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Attribute::ATTR_PORTRAIT))),
2135 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Attribute::ATTR_POSTAL_ADDRESS))),
2137 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Attribute::ATTR_RELATION))),
2139 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Attribute::ATTR_SIP_ADDRESS))),
2141 ContactsNapiUtils::ToInt32Value(env, static_cast<int32_t>(Attribute::ATTR_WEBSITE))),
2144 napi_define_class(env, "Attribute", NAPI_AUTO_LENGTH, ContactsNapiUtils::CreateClassConstructor, nullptr,
2146 napi_set_named_property(env, exports, "Attribute", result);
2150 void Init(napi_env env, napi_value exports)
2167 napi_define_properties(env, exports, sizeof(exportFuncs) / sizeof(*exportFuncs), exportFuncs);
2169 DeclareContactConst(env, exports);
2170 DeclareEmailConst(env, exports);
2171 DeclareEventConst(env, exports);
2172 DeclareImAddressConst(env, exports);
2173 DeclarePhoneNumberConst(env, exports);
2174 DeclarePostalAddressConst(env, exports);
2175 DeclareRelationConst(env, exports);
2176 DeclareSipAddressConst(env, exports);
2177 DeclareAttributeConst(env, exports);