50909fb18fde8f1b9120219964806b14d0c443d6
[platform/core/api/url-download.git] / include / download_extension.h
1 /*
2  * Copyright (c) 2023 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_WEB_DOWNLOAD_EXTENSION_H__
18 #define __TIZEN_WEB_DOWNLOAD_EXTENSION_H__
19
20 #ifdef __cplusplus
21 extern "C"
22 {
23 #endif
24
25 /**
26  * @file download_extension.h
27  */
28
29  /**
30  * @addtogroup CAPI_WEB_DOWNLOAD_MODULE
31  * @{
32  */
33
34
35 /**
36  * @brief Sets the max size of the cache.
37  *
38  * @since_tizen 7.5
39  * @privlevel public
40  * @privilege %http://tizen.org/privilege/download
41  *
42  * @remarks The default size is 1000 MB.
43  *
44  * @param[in] size  The max size of the cache (MB)
45  *
46  * @return @c 0 on success,
47  *         otherwise a negative error value
48  *
49  * @retval #DOWNLOAD_ERROR_NONE              Successful
50  * @retval #DOWNLOAD_ERROR_NOT_SUPPORTED     Not supported
51  * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied
52  * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter
53  * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND      No download ID
54  *
55  * @see download_get_cache_max_size()
56  */
57 int download_set_cache_max_size(unsigned int size);
58
59
60 /**
61  * @brief Gets the max size of the cache.
62  *
63  * @since_tizen 7.5
64  * @privlevel public
65  * @privilege %http://tizen.org/privilege/download
66  *
67  * @param[out] size  The max size of the cache (MB)
68  *
69  * @return @c 0 on success,
70  *         otherwise a negative error value
71  *
72  * @retval #DOWNLOAD_ERROR_NONE              Successful
73  * @retval #DOWNLOAD_ERROR_NOT_SUPPORTED     Not supported
74  * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied
75  * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter
76  * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND      No download ID
77  *
78  * @see download_set_cache_max_size()
79  */
80 int download_get_cache_max_size(unsigned int *size);
81
82
83 /**
84  * @brief Clears all cache.
85  *
86  * @since_tizen 7.5
87  * @privlevel public
88  * @privilege %http://tizen.org/privilege/download
89  *
90  * @return 0 on success, otherwise a negative error value
91  *
92  * @retval #DOWNLOAD_ERROR_NONE              Successful
93  * @retval #DOWNLOAD_ERROR_NOT_SUPPORTED     Not supported
94  * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied
95  * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND      No download ID
96  */
97 int download_reset_all_cache(void);
98
99
100 /**
101  * @brief Sets the path of the cache stored.
102  *
103  * @since_tizen 7.5
104  * @privlevel public
105  * @privilege %http://tizen.org/privilege/download
106  *
107  * @param[in] path  the path of the cache stored
108  *
109  * @return @c 0 on success,
110  *         otherwise a negative error value
111  *
112  * @retval #DOWNLOAD_ERROR_NONE              Successful
113  * @retval #DOWNLOAD_ERROR_NOT_SUPPORTED     Not supported
114  * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied
115  * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter
116  * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND      No download ID
117  *
118  * @see download_get_cache_path()
119  */
120 int download_set_cache_path(const char *path);
121
122
123 /**
124  * @brief Gets the path of the cache stored.
125  *
126  * @since_tizen 7.5
127  * @privlevel public
128  * @privilege %http://tizen.org/privilege/download
129  *
130  * @param[out] path  the path of the cache stored
131  *
132  * @return @c 0 on success,
133  *         otherwise a negative error value
134  *
135  * @retval #DOWNLOAD_ERROR_NONE              Successful
136  * @retval #DOWNLOAD_ERROR_NOT_SUPPORTED     Not supported
137  * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied
138  * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter
139  * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND      No download ID
140  *
141  * @see download_set_cache_path()
142  */
143 int download_get_cache_path(char **path);
144
145
146 /**
147  * @brief Sets the life cycle of the cache.
148  *
149  * @since_tizen 7.5
150  * @privlevel public
151  * @privilege %http://tizen.org/privilege/download
152  *
153  * @remarks The default time is 48 * 3600 seconds.
154  *
155  * @param[in] time  The life cycle of the cache (seconds)
156  *
157  * @return @c 0 on success,
158  *         otherwise a negative error value
159  *
160  * @retval #DOWNLOAD_ERROR_NONE              Successful
161  * @retval #DOWNLOAD_ERROR_NOT_SUPPORTED     Not supported
162  * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied
163  * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter
164  * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND      No download ID
165  *
166  * @see download_get_cache_lifecycle()
167  */
168 int download_set_cache_lifecycle(unsigned int time);
169
170
171 /**
172  * @brief Gets the life cycle of the cache.
173  *
174  * @since_tizen 7.5
175  * @privlevel public
176  * @privilege %http://tizen.org/privilege/download
177  *
178  * @param[out] time  The life cycle of the cache (seconds)
179  *
180  * @return @c 0 on success,
181  *         otherwise a negative error value
182  *
183  * @retval #DOWNLOAD_ERROR_NONE              Successful
184  * @retval #DOWNLOAD_ERROR_NOT_SUPPORTED     Not supported
185  * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied
186  * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter
187  * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND      No download ID
188  *
189  * @see download_set_cache_lifecycle()
190  */
191 int download_get_cache_lifecycle(unsigned int *time);
192 /**
193  * @}
194  */
195
196 #ifdef __cplusplus
197 }
198 #endif
199
200 #endif /* __TIZEN_WEB_DOWNLOAD_EXTENSION_H__ */