rs_plugin_common_interfaces/lookup/
mod.rs

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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
use std::collections::HashMap;

use crate::{domain::rs_ids::RsIds, request::RsRequest};
use crate::PluginCredential;
use serde::{Deserialize, Serialize};
use strum_macros::EnumString;

#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, strum_macros::Display,EnumString, Default)]
#[serde(rename_all = "camelCase")] 
#[strum(serialize_all = "camelCase")]
pub enum RsLookupSourceResult {
    Requests(Vec<RsRequest>),
    NotFound,
    #[default]
    NotApplicable
}


#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
#[serde(rename_all = "camelCase")] 
pub struct RsLookupPerson {
    pub name: String,
    pub ids: Option<RsIds>
}


#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
#[serde(rename_all = "camelCase")] 
pub struct RsLookupSerie {
    pub name: String,
    pub ids: Option<RsIds>
}

#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
#[serde(rename_all = "camelCase")] 
pub struct RsLookupSerieSeason {
    pub name: String,
    pub ids: Option<RsIds>
}

#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
#[serde(rename_all = "camelCase")] 
pub struct RsLookupEpisode {
    pub serie: String,
    pub ids: Option<RsIds>,

    pub season: u32,
    pub number: Option<u32>
}

#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
#[serde(rename_all = "camelCase")] 
pub struct RsLookupBook {
    pub title: String,
    pub author: String,
    pub ids: Option<RsIds>
}
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
#[serde(rename_all = "camelCase")] 
pub struct RsLookupSong {
    pub title: String,
    pub author: Option<String>,
    pub album: Option<String>,
    pub ids: Option<RsIds>
}

#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
#[serde(rename_all = "camelCase")] 
pub struct RsLookupMedia {
    pub search: String,
    pub ids: Option<RsIds>
}

#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
#[serde(rename_all = "camelCase")] 
pub struct RsLookupMovie {
    pub name: String,
    pub ids: Option<RsIds>
}


#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, strum_macros::Display,EnumString)]
#[serde(rename_all = "camelCase")] 
#[strum(serialize_all = "camelCase")]
pub enum RsLookupQuery {
    Book(RsLookupBook),
    Media(RsLookupMedia),
    Episode(RsLookupEpisode),
    Movie(RsLookupMovie),
    Person(RsLookupPerson),
    Serie(RsLookupSerie),
    SerieSeason(RsLookupSerieSeason),
    Song(RsLookupSong)
}



#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(rename_all = "camelCase")] 
pub struct RsLookupWrapper {
    pub query: RsLookupQuery,
    pub credential: Option<PluginCredential>,
    pub params: Option<HashMap<String, String>>

}