chore: use options as param instead of custom_fields for config_option_update

This commit is contained in:
rzmk 2025-05-02 16:50:50 -04:00
parent ccaefd8076
commit b826768049
No known key found for this signature in database

View file

@ -2359,14 +2359,14 @@ impl CKAN {
#[builder] #[builder]
pub async fn config_option_update( pub async fn config_option_update(
&self, &self,
custom_fields: Option<serde_json::Value>, options: Option<serde_json::Value>,
) -> Result<serde_json::Value, Box<dyn std::error::Error>> { ) -> Result<serde_json::Value, Box<dyn std::error::Error>> {
let endpoint = self.url.clone() + "/api/3/action/config_option_update"; let endpoint = self.url.clone() + "/api/3/action/config_option_update";
let mut map: HashMap<&str, serde_json::Value> = HashMap::new(); let mut map: HashMap<&str, serde_json::Value> = HashMap::new();
let mut custom_map: HashMap<String, serde_json::Value> = HashMap::new(); let mut custom_map: HashMap<String, serde_json::Value> = HashMap::new();
if let Some(custom) = custom_fields { if let Some(options_obj) = options {
if custom.is_object() { if options_obj.is_object() {
let custom_temp_map = custom.as_object().unwrap(); let custom_temp_map = options_obj.as_object().unwrap();
custom_map.extend( custom_map.extend(
custom_temp_map custom_temp_map
.iter() .iter()