wx_work/
media.rs

1use serde::Deserialize;
2
3pub enum FileType {
4    Image,
5    Voice,
6    Video,
7    File,
8}
9
10impl FileType {
11    pub(crate) fn type_desc(&self) -> &'static str {
12        use FileType::*;
13        match self {
14            Image => "image",
15            Voice => "voice",
16            Video => "video",
17            File => "file",
18        }
19    }
20}
21
22#[derive(Debug, Deserialize)]
23pub struct UploadFileResponse {
24    pub(crate) errcode: u64,
25    pub(crate) errmsg: String,
26    #[serde(rename = "type")]
27    #[serde(default)]
28    pub ty: String,
29    #[serde(default)]
30    pub media_id: String,
31    #[serde(default)]
32    pub created_at: String,
33}
34
35#[derive(Debug, Deserialize)]
36pub struct UploadImageResponse {
37    pub(crate) errcode: u64,
38    pub(crate) errmsg: String,
39    #[serde(default)]
40    pub url: String,
41}