From 427cc0ebc2aa50dbfa1e0f01f2de6b313bfcab30 Mon Sep 17 00:00:00 2001 From: lifegpc Date: Sun, 10 Jul 2022 06:04:46 +0000 Subject: [PATCH] Update --- src/fanbox/article/body.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/fanbox/article/body.rs b/src/fanbox/article/body.rs index 4306ec9..1894f00 100644 --- a/src/fanbox/article/body.rs +++ b/src/fanbox/article/body.rs @@ -1,6 +1,9 @@ +use super::super::check::CheckUnkown; +use super::super::error::FanboxAPIError; use super::block::FanboxArticleBlock; use crate::fanbox_api::FanboxClientInternal; use json::JsonValue; +use proc_macros::check_json_keys; use std::fmt::Debug; use std::sync::Arc; @@ -36,6 +39,21 @@ impl FanboxArticleBody { } } +impl CheckUnkown for FanboxArticleBody { + fn check_unknown(&self) -> Result<(), FanboxAPIError> { + check_json_keys!("blocks"+, "imageMap", "fileMap", "embedMap", "urlEmbedMap",); + match self.blocks() { + Some(blocks) => { + for i in blocks { + i.check_unknown()?; + } + } + None => {} + } + Ok(()) + } +} + impl Debug for FanboxArticleBody { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("FanboxArticleBody")