tiktok_api/objects/oauth/
response_error_body.rs1use serde::{Deserialize, Serialize};
2
3use crate::objects::oauth::{Error, Message};
4
5#[derive(Deserialize, Serialize, Debug, Clone)]
7pub struct ResponseErrorBody {
8 pub data: Error,
9 pub message: Message,
10}
11
12#[cfg(test)]
13mod tests {
14 use super::*;
15
16 #[test]
17 fn test_de() {
18 match serde_json::from_str::<ResponseErrorBody>(include_str!(
19 "../../../tests/response_body_files/oauth/refresh_token__err.json"
20 )) {
21 Ok(err_json) => {
22 assert_eq!(err_json.data.error_code, 10002);
23 assert_eq!(err_json.message, Message::ConstantError);
24 }
25 x => panic!("{x:?}"),
26 }
27 }
28}