1use serde::{Deserialize, Serialize};
2
3#[derive(Serialize, Deserialize, Debug)]
6pub struct CreateRequest {
7 pub url: String,
8 pub domain: Option<String>,
9 pub alias: Option<String>,
10 pub tags: Option<String>,
11 pub expires_at: Option<String>,
12}
13
14impl CreateRequest {
15 pub fn new(url: String) -> Self {
16 Self {
17 url,
18 domain: None,
19 alias: None,
20 tags: None,
21 expires_at: None,
22 }
23 }
24}
25
26#[derive(Serialize, Deserialize, Debug)]
27pub struct UrlData {
28 pub domain: String,
29 pub alias: String,
30 pub deleted: bool,
31 pub archived: bool,
32 pub tiny_url: String,
33 pub created_at: String,
34 pub expires_at: Option<String>,
35 pub url: String,
36}
37
38#[derive(Serialize, Deserialize, Debug)]
39pub struct CreateResponse {
40 pub code: i32,
41 pub errors: Vec<String>,
42 pub data: Option<UrlData>,
43}