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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252


//! All request parameters are here
//! all these structs can be serialized into an urlencoded string
//!
//! __b-but why n-not in different mods, anon? :(__
//!
//! because the api is so shitty, there is no logical distiction between the api classes.
//! it's just a huge clusterfuck
//!
//! __why usize instead of i64?__
//!
//! when you know whats coming, why don't be prepared? (an id will never be < 0)



pub trait PageableParameter {
	fn page_mut(&mut self) -> &mut Option<usize>;
	fn limit_mut(&mut self) -> &mut Option<usize>;
}




#[derive(Serialize, Debug, Clone)]
pub struct InfoGetFullEntry {
	pub id: usize,
}



#[derive(Serialize, Debug, Clone)]
pub struct InfoGetEntry {
	pub id: usize,
}


#[derive(Serialize, Debug, Clone)]
pub struct InfoGetNames {
	pub id: usize,
}



#[derive(Serialize, Debug, Clone)]
pub struct InfoGetGate {
	pub id: usize,
}





#[derive(Serialize, Debug, Clone)]
pub struct InfoGetLang {
	pub id: usize,
}



#[derive(Serialize, Debug, Clone)]
pub struct InfoGetSeason {
	pub id: usize,
}


#[derive(Serialize, Debug, Clone)]
pub struct InfoGetGroups {
	pub id: usize,
}



#[derive(Serialize, Debug, Clone)]
pub struct InfoGetPublisher {
	pub id: usize,
}




#[derive(Serialize, Debug, Clone)]
pub struct InfoGetListinfo {
	pub id: usize,
	pub p: Option<i64>,
	pub limit: Option<i64>,
}



#[derive(Serialize, Debug, Clone)]
pub struct InfoGetComments {
	pub id: usize,
	pub p: Option<usize>,
	pub limit: Option<usize>,
	pub sort: Option<String>,
}

impl PageableParameter for InfoGetComments {
	fn page_mut(&mut self) -> &mut Option<usize>
	{
		&mut self.p
	}
	fn limit_mut(&mut self) -> &mut Option<usize>
	{
		&mut self.limit
	}
}




#[derive(Serialize, Debug, Clone)]
pub struct InfoGetRelations {
	pub info_id: usize,
	pub is_h: Option<bool>,
}



#[derive(Serialize, Debug, Clone)]
pub struct InfoEntryTags {
	pub id: usize,
}



#[derive(Serialize, Debug, Clone)]
pub struct GetTranslatorgroup {
	pub id: usize,
}



#[derive(Serialize, Debug, Clone)]
pub struct InfoGetIndustry {
	pub id: usize,
}


#[derive(Serialize, Debug, Clone)]
pub struct InfoSetUserInfo {
	pub id: usize,
	/// since 'type' is a rust keyword, this parameter is renamed
	#[serde(rename = "type")]
	pub type_: String,
}



#[derive(Serialize, Debug, Clone)]
pub struct ListGetList {
	pub kat: Option<String>,
	pub medium: Option<String>,
	pub is_h: Option<String>,
	pub start: Option<String>,
	pub sort: Option<String>,
	pub sort_type: Option<String>,
	pub p: Option<i64>,
	pub limit: Option<i64>,
}


impl Iterator for ListGetList {
	type Item = Self;

	fn next(&mut self) -> Option<Self::Item>
	{
		self.p = match self.p
		{
			Some(p) => Some(p + 1),
			None => Some(0),
		};

		Some(self.clone())
	}
}



#[derive(Serialize, Debug, Clone)]
pub struct UserLogin {
	pub username: String,
	pub password: String,
	pub secretkey: Option<String>,
}



#[derive(Serialize, Debug, Clone)]
pub struct UserLogout {}



#[derive(Serialize, Debug, Clone)]
pub struct UserUserinfo {
	pub uid: Option<usize>,
	pub username: Option<String>,
}



#[derive(Serialize, Debug, Clone)]
pub struct UserGetTopten {
	pub uid: Option<usize>,
	pub username: Option<String>,
	pub kat: Option<String>,
	pub is_h: Option<bool>,
}



#[derive(Serialize, Debug, Clone)]
pub struct UserGetList {
	pub uid: Option<usize>,
	pub username: Option<String>,
	pub kat: Option<String>,
	pub search: Option<String>,
	pub search_start: Option<String>,
	pub is_h: Option<bool>,
	pub filter: Option<u64>,
	pub sort: Option<String>,

	pub p: Option<i64>,
	pub limit: Option<u64>,
}



#[derive(Serialize, Debug, Clone)]
pub struct UserGetLatestComments {
	pub uid: Option<usize>,
	pub username: Option<String>,
	pub kat: Option<String>,
	pub length: Option<u64>,

	pub p: Option<u64>,
	pub limit: Option<u64>,
}



#[derive(Serialize, Debug, Clone)]
pub struct UserGetHistory {
	pub uid: Option<usize>,
	pub username: Option<String>,
	pub is_h: Option<bool>,
	pub filter: Option<u64>,

	pub p: Option<u64>,
	pub limit: Option<u64>,
}