xt_oss/oss/entities/
callback.rs1use serde::{Deserialize, Serialize};
2use std::fmt;
3#[derive(Serialize, Deserialize, Debug, Clone, Copy, Default)]
4pub enum CallbackBodyType {
5 FormUrlEncoded,
6 #[default]
7 JSON,
8}
9
10impl fmt::Display for CallbackBodyType {
11 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
12 match self {
13 Self::FormUrlEncoded => write!(f, "{}", "a"),
14 Self::JSON => write!(f, "{}", "b"),
15 }
16 }
17}
18
19#[derive(Debug, Serialize, Deserialize, Default, Clone)]
20pub struct CallbackBody {
21 pub bucket: String,
23 pub object: String,
25 pub etag: String,
27 pub size: String,
29 pub mime_type: String,
31 pub imageinfo_height: String,
33 pub imageinfo_width: String,
35 pub imageinfo_format: String,
37 pub crc64: String,
39 pub content_md5: String,
41 pub vpc_id: String,
43 pub client_ip: String,
45 pub req_id: String,
47 pub operation: String,
49}
50
51#[derive(Debug, Serialize, Deserialize, Default, Clone)]
52pub struct Callback {
53 pub callback_url: String,
54 pub callback_host: Option<String>,
55 pub callback_body: CallbackBody,
56 pub callback_sni: Option<String>,
57 pub callback_body_type: Option<CallbackBodyType>,
58}