• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 DATAPROXY_HANDLE_H
17 #define DATAPROXY_HANDLE_H
18 
19 #include <string>
20 
21 #include "datashare_business_error.h"
22 #include "datashare_errno.h"
23 #include "dataproxy_handle_common.h"
24 #include "datashare_observer.h"
25 
26 namespace OHOS {
27 
28 namespace DataShare {
29 class DataProxyHandle : public std::enable_shared_from_this<DataProxyHandle> {
30 public:
31     /**
32      * @brief Destructor.
33      */
34     ~DataProxyHandle() = default;
35 
36     /**
37      * @brief Creates a DataProxyHandle instance.
38      *
39      * @return Returns the created DataProxyHandle instance.
40      */
41     static std::pair<int, std::shared_ptr<DataProxyHandle>> Create();
42 
43     std::vector<DataProxyResult> PublishProxyData(
44         const std::vector<DataShareProxyData> &proxyData, const DataProxyConfig &proxyConfig);
45 
46     std::vector<DataProxyResult> DeleteProxyData(
47         const std::vector<std::string> &uris, const DataProxyConfig &proxyConfig);
48 
49     static std::vector<DataProxyGetResult> GetProxyData(
50         const std::vector<std::string> uris, const DataProxyConfig &proxyConfig);
51 
52     std::vector<DataProxyResult> SubscribeProxyData(const std::vector<std::string> &uris,
53         const std::function<void(const std::vector<DataProxyChangeInfo> &changeNode)> &callback);
54 
55     std::vector<DataProxyResult> UnsubscribeProxyData(const std::vector<std::string> &uris);
56 };
57 } // namespace DataShare
58 } // namespace OHOS
59 #endif // DATAPROXY_HANDLE_H