Add Foreach depdency API for Archiveinfo
[platform/core/appfw/pkgmgr-info.git] / include / pkgmgr-info.h
index 6d80513..8fac17b 100644 (file)
@@ -1950,7 +1950,7 @@ int pkgmgrinfo_pkginfo_is_readonly(pkgmgrinfo_pkginfo_h handle, bool *readonly);
 
 /**
  * @fn int pkgmgrinfo_pkginfo_is_update(pkgmgrinfo_pkginfo_h handle, bool *update)
- * @brief      This API gets the package 'upate' value from the package ID
+ * @brief      This API gets the package 'update' value from the package ID
  *
  * @par                This API is for package-manager client application
  * @par Sync (or) Async : Synchronous API
@@ -6900,17 +6900,43 @@ static int get_pkg_archive_icon(const char *path)
 int pkgmgrinfo_archiveinfo_get_icon(pkgmgrinfo_archiveinfo_h handle,
                const unsigned char **icon, size_t *size);
 
-int pkgmgrinfo_appinfo_foreach_component_info(pkgmgrinfo_appinfo_h handle,
-               pkgmgrinfo_component_info_list_cb callback, void *user_data);
-
-int pkgmgrinfo_compinfo_get_appid(pkgmgrinfo_compinfo_h handle,
-               const char **appid);
-int pkgmgrinfo_compinfo_get_compid(pkgmgrinfo_compinfo_h handle,
-               const char **compid);
-int pkgmgrinfo_compinfo_get_type(pkgmgrinfo_compinfo_h handle,
-               const char **type);
-int pkgmgrinfo_compinfo_get_launch_mode(pkgmgrinfo_compinfo_h handle,
-               const char **launch_mode);
+/**
+ * @fn int pkgmgrinfo_archiveinfo_foreach_dependency(pkgmgrinfo_archiveinfo_h handle, pkgmgrinfo_dependency_cb callback, void *user_data)
+ * @brief      This API retrieve the dependency information and invoke given callback for it.
+ *
+ * @par                This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in]  handle  pointer to package archive info handle
+ * @param[in]  callback        callback to be invoked for each retrieved dependency information
+ * @param[in]  user_data       user data to be passed to callback
+ * @return     0 if success, error code(<0) if fail
+ * @retval     PMINFO_R_OK     success
+ * @retval     PMINFO_R_EINVAL invalid argument
+ * @retval     PMINFO_R_ERROR  internal error
+ * @pre                pkgmgrinfo_archiveinfo_get_archiveinfo()
+ * @post       pkgmgrinfo_archiveinfo_destroy_archiveinfo()
+ * @code
+static int get_pkg_archive_dependency(const char *path, pkgmgrinfo_pkg_dependency_list_cb callback)
+{
+       int ret = 0;
+       size_t icon_size = 0;
+       pkgmgrinfo_archiveinfo_h handle;
+       ret = pkgmgrinfo_archiveinfo_get_archiveinfo(path, &handle);
+       if (ret != PMINFO_R_OK)
+               return -1;
+       ret = pkgmgrinfo_archiveinfo_foreach_dependency(handle, callback, NULL);
+       if (ret != PMINFO_R_OK) {
+               pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle);
+               return -1;
+       }
+       pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle);
+       return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_archiveinfo_foreach_dependency(pkgmgrinfo_archiveinfo_h handle,
+               pkgmgrinfo_pkg_dependency_list_cb callback, void *user_data);
 
 /**
  * @pkgmgrinfo client API end