1 /*
2  * Copyright (c) 2021-2022 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 CONTACT_CONTROL_H
17 #define CONTACT_CONTROL_H
18 
19 #include "ability.h"
20 #include "ability_context.h"
21 #include "context.h"
22 #include "datashare_helper.h"
23 #include "datashare_predicates.h"
24 #include "rdb_errno.h"
25 #include "rdb_helper.h"
26 #include "rdb_open_callback.h"
27 #include "rdb_predicates.h"
28 #include "rdb_store.h"
29 #include "result_set.h"
30 
31 #include "contacts_napi_object.h"
32 
33 namespace OHOS {
34 namespace ContactsApi {
35 class ContactsControl {
36 public:
37     ContactsControl();
38     ~ContactsControl();
39     int RawContactInsert(std::shared_ptr<DataShare::DataShareHelper> dataShareHelper,
40         DataShare::DataShareValuesBucket rawContactValues);
41     int ContactDataInsert(std::shared_ptr<DataShare::DataShareHelper> dataShareHelper,
42         std::vector<DataShare::DataShareValuesBucket> contactsDataValues);
43     int RawContactUpdate(std::shared_ptr<DataShare::DataShareHelper> dataShareHelper,
44         DataShare::DataShareValuesBucket updateValues, DataShare::DataSharePredicates predicates);
45     int ContactDataUpdate(std::shared_ptr<DataShare::DataShareHelper> dataShareHelper,
46         DataShare::DataShareValuesBucket updateValues, DataShare::DataSharePredicates predicates);
47     int ContactDelete(std::shared_ptr<DataShare::DataShareHelper> dataShareHelper,
48         DataShare::DataSharePredicates predicates);
49     int ContactDataDelete(std::shared_ptr<DataShare::DataShareHelper> dataShareHelper,
50         DataShare::DataSharePredicates predicates);
51     std::shared_ptr<DataShare::DataShareResultSet> ContactQuery(
52         std::shared_ptr<DataShare::DataShareHelper> dataShareHelper, std::vector<std::string> columns,
53         DataShare::DataSharePredicates predicates);
54     std::shared_ptr<DataShare::DataShareResultSet> ContactDataQuery(
55         std::shared_ptr<DataShare::DataShareHelper> dataShareHelper, std::vector<std::string> columns,
56         DataShare::DataSharePredicates predicates);
57     std::shared_ptr<DataShare::DataShareResultSet> GroupsQuery(
58         std::shared_ptr<DataShare::DataShareHelper> dataShareHelper, std::vector<std::string> columns,
59         DataShare::DataSharePredicates predicates);
60     std::shared_ptr<DataShare::DataShareResultSet> MyCardQuery(
61         std::shared_ptr<DataShare::DataShareHelper> dataShareHelper, std::vector<std::string> columns,
62         DataShare::DataSharePredicates predicates);
63     std::shared_ptr<DataShare::DataShareResultSet> HolderQuery(
64         std::shared_ptr<DataShare::DataShareHelper> dataShareHelper, std::vector<std::string> columns,
65         DataShare::DataSharePredicates predicates);
66 };
67 } // namespace ContactsApi
68 } // namespace OHOS
69 #endif // CONTACT_CONTROL_H
70