Add pkgmgrinfo_pkginfo_get_metadata_value()
[platform/core/appfw/pkgmgr-info.git] / include / pkgmgr-info.h
index ee8cb74..d0eea1a 100644 (file)
@@ -1794,6 +1794,42 @@ static int get_support_mode(const char *pkgid)
 int pkgmgrinfo_pkginfo_get_support_mode(pkgmgrinfo_pkginfo_h handle, int *support_mode);
 
 /**
+ * @fn int pkgmgrinfo_pkginfo_get_metadata_value(pkgmgrinfo_pkginfo_h handle, const char *metadata_key, char **metadata_value)
+ * @brief      This API gets metadata value by given metadata key
+ *
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in]  handle  pointer to the package info handle
+ * @param[in]  metadata_key    metadata key
+ * @param[out] metadata_value          pointer to hold metadata value
+ * @return     0 if success, error code(<0) if fail
+ * @retval     PMINFO_R_OK     success
+ * @retval     PMINFO_R_EINVAL invalid argument
+ * @code
+static int get_metadata_value(const char *pkgid, const char *metadata_key)
+{
+       int ret = 0;
+       pkgmgrinfo_pkginfo_h handle = NULL;
+       char *metadata_value = NULL;
+
+       ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+       if (ret != PMINFO_R_OK)
+               return -1;
+
+       ret = pkgmgrinfo_pkginfo_get_metadata_value(handle, metadata_key, &metadata_value);
+       if (ret != PMINFO_R_OK) {
+               pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+               return -1;
+       }
+
+       pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+       return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_metadata_value(pkgmgrinfo_pkginfo_h handle, const char *metadata_key, char **metadata_value);
+
+/**
  * @fn int pkgmgrinfo_pkginfo_compare_pkg_cert_info(const char *lhs_package_id, const char *rhs_package_id, pkgmgrinfo_cert_compare_result_type_e *compare_result)
  * @brief      This API compare the cert information from given package id
  *