diff options
Diffstat (limited to 'src/verify.rs')
-rw-r--r-- | src/verify.rs | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/src/verify.rs b/src/verify.rs index 57e250d..bab1f18 100644 --- a/src/verify.rs +++ b/src/verify.rs @@ -14,12 +14,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <https://www.gnu.org/licenses/>. -use crate::{client::Client, error::Error, XChan, ZotAPI}; +use crate::{error::Error, XChan}; use serde::Deserialize; use std::convert::TryFrom; -use zotapi_derive::ZotAPI; +//use zotapi_derive::ZotAPI; -#[derive(Deserialize, Debug, ZotAPI)] +#[derive(Deserialize, Debug)] pub struct Channel { #[serde(alias = "channel_id")] pub id: u32, @@ -137,20 +137,3 @@ impl<'a> TryFrom<&'a str> for Channel { Ok(serde_json::from_str(s)?) } } - -#[derive(Default)] -pub struct ChannelRequest; - -impl ChannelRequest { - pub async fn fetch_raw(&self, client: &Client) -> Result<String, Error> { - Ok(client.get("verify").send().await?.text().await?) - } - - pub async fn fetch(&self, client: &Client) -> Result<Channel, Error> { - let raw = self.fetch_raw(&client).await?; - let mut channel: Channel = serde_json::from_str(&raw)?; - channel.xchan = serde_json::from_str(&raw)?; - - Ok(channel) - } -} |