Add a new internal API
[platform/core/api/package-manager.git] / include / package_manager_extension.h
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef __TIZEN_APPFW_PACKAGE_MANAGER_EXTENSION_H
18 #define __TIZEN_APPFW_PACKAGE_MANAGER_EXTENSION_H
19
20 #include "package_manager.h"
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 /**
27  * @file package_manager_extension.h
28  */
29
30 /**
31  * @addtogroup CAPI_PACKAGE_MANAGER_MODULE
32  * @{
33  */
34
35 /**
36  * @platform
37  * @brief Installs the package located at the given path as the runtime mountable package, asynchronously.
38  * @since_tizen 4.0
39  * @privlevel platform
40  * @privilege %http://tizen.org/privilege/packagemanager.admin
41  * @param[in]  request The request handle
42  * @param[in]  path    The absolute path to the package to be installed
43  * @param[out] id      The ID of the request to the package manager
44  * @return @c 0 on success,
45  *         otherwise a negative error value
46  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
47  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
48  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
49  * @see package_manager_request_uninstall()
50  */
51 int package_manager_request_mount_install(package_manager_request_h request, const char *path, int *id);
52
53
54 /**
55  * @platform
56  * @brief Installs the package located at the given path as the runtime mountable package, asynchronously.
57  * @details The progress of the request is asynchronously received by the callback function.
58  *          The @a callback is the individual callback only called for the current API call.
59  *          The @a callback is the only callback called, even if another callback was set for this request
60  *          with package_manager_request_set_event_cb().
61  * @since_tizen 4.0
62  * @privlevel platform
63  * @privilege %http://tizen.org/privilege/packagemanager.admin
64  * @param[in]  request   The request handle
65  * @param[in]  path      The absolute path to the package to be installed
66  * @param[in]  callback  The callback function to be invoked
67  * @param[in]  user_data The user data to be passed to the callback function
68  * @param[out] id        The ID of the request to the package manager
69  * @return @c 0 on success,
70  *         otherwise a negative error value
71  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
72  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
73  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
74  */
75 int package_manager_request_mount_install_with_cb(package_manager_request_h request,
76                                                 const char *path,
77                                                 package_manager_request_event_cb callback,
78                                                 void *user_data,
79                                                 int *id);
80
81 /**
82  * @platform
83  * @brief Installs the packages located at the given paths as the runtime mountable package, asynchronously.
84  * @since_tizen 6.0
85  * @privlevel platform
86  * @privilege %http://tizen.org/privilege/packagemanager.admin
87  * @param[in]  request     The request handle
88  * @param[in]  paths       The array of absolute paths to the packages to be installed
89  * @param[in]  paths_count The number of paths in array
90  * @param[out] id          The ID of the request to the package manager
91  * @return @c 0 on success,
92  *         otherwise a negative error value
93  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
94  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
95  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
96  * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE   No such package
97  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
98  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
99  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
100  */
101 int package_manager_request_mount_install_packages(package_manager_request_h request,
102                                                 const char **paths,
103                                                 int paths_count,
104                                                 int *id);
105
106 /**
107  * @platform
108  * @brief Installs the packages located at the given paths as the runtime mountable package, asynchronously.
109  * @details The progress of the request is asynchronously received by the callback function.
110  *          The @a callback is the individual callback only called for the current API call.
111  *          The @a callback is the only callback called, even if another callback was set for this request
112  *          with package_manager_request_set_event_cb().
113  * @since_tizen 6.0
114  * @privlevel platform
115  * @privilege %http://tizen.org/privilege/packagemanager.admin
116  * @param[in]  request       The request handle
117  * @param[in]  paths         The array of absolute paths to the packages to be installed
118  * @param[in]  paths_count   The number of paths in array
119  * @param[in]  callback      The callback function to be invoked
120  * @param[in]  user_data     The user data to be passed to the callback function
121  * @param[out] id            The ID of the request to the package manager
122  * @return @c 0 on success,
123  *         otherwise a negative error value
124  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
125  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
126  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
127  * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE   No such package
128  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
129  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
130  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
131  */
132 int package_manager_request_mount_install_packages_with_cb(package_manager_request_h request,
133                                                 const char **paths,
134                                                 int paths_count,
135                                                 package_manager_request_event_cb callback,
136                                                 void *user_data,
137                                                 int *id);
138
139
140 /**
141  * @platform
142  * @brief Clears a data in given relative file path of user directories used by applications in the given package.
143  * @details A file or directory specified with the @a file_path stored in data directories used by applications in the package specified with the @a package_id are removed.
144  * @since_tizen 7.5
145  * @privlevel platform
146  * @privilege %http://tizen.org/privilege/packagemanager.admin
147  * @param[in] package_id  The package ID
148  * @param[in] file_path   The file path that is relative path from the given package user data directory.
149  * @return @c 0 on success,
150  *         otherwise a negative error value
151  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
152  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
153  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
154  * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE   No such package
155  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
156  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
157  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
158  */
159 int package_manager_clear_user_data_with_path(const char *package_id, const char *file_path);
160
161 /**
162 * @}
163 */
164
165 #ifdef __cplusplus
166 }
167 #endif
168
169 #endif /* __TIZEN_APPFW_PACKAGE_MANAGER_EXTENSION_H */