rosu_render/model/
skin_custom.rs1use hyper::{body::Bytes, StatusCode};
2use serde::Deserialize;
3
4use crate::{request::Requestable, ClientError};
5
6#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
8pub struct SkinInfo {
9 #[serde(rename = "skinName")]
11 pub name: Box<str>,
12 #[serde(rename = "skinAuthor")]
14 pub author: Box<str>,
15 #[serde(rename = "downloadLink")]
17 pub download_link: Box<str>,
18}
19
20impl Requestable for SkinInfo {
21 fn response_error(status: StatusCode, bytes: Bytes) -> ClientError {
22 if status == StatusCode::NOT_FOUND {
23 match serde_json::from_slice(&bytes) {
24 Ok(error) => ClientError::SkinDeleted { error },
25 Err(source) => ClientError::Parsing {
26 body: bytes.into(),
27 source,
28 },
29 }
30 } else {
31 ClientError::response_error(bytes, status.as_u16())
32 }
33 }
34}
35
36#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
37pub struct SkinDeleted {
38 pub found: bool,
40 pub removed: bool,
42 pub message: Box<str>,
44 pub name: Option<Box<str>>,
46 pub author: Option<Box<str>>,
48}