1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//! Lists

use User;
use std::borrow::Cow;
use types::DateTime;
use util;

/// Represents a List.
///
/// # Reference
///
/// 1. [GET lists/show — Twitter Developers](https://dev.twitter.com/rest/reference/get/lists/show)
#[derive(Clone, Debug, Deserialize, PartialEq)]
pub struct List<'a> {
    #[serde(borrow)]
    pub slug: Cow<'a, str>,

    #[serde(borrow)]
    pub name: Cow<'a, str>,

    #[serde(deserialize_with = "util::deserialize_datetime")]
    pub created_at: DateTime,

    #[serde(borrow)]
    pub uri: Cow<'a, str>,

    pub subscriber_count: u64,

    pub member_count: u64,

    #[serde(borrow)]
    pub mode: Mode<'a>,

    pub id: ListId,

    #[serde(borrow)]
    pub full_name: Cow<'a, str>,

    #[serde(borrow)]
    pub description: Cow<'a, str>,

    #[serde(borrow)]
    pub user: User<'a>,

    pub following: bool,
}

string_enums! {
    /// Represents `mode` field of `List`.
    #[derive(Clone, Debug)]
    pub enum Mode<'a> {
        :Public("public"),
        :Private("private");
        :Custom(_),
    }
}

/// ID of a list.
pub type ListId = u64;