dmm_api/
item_list.rs

1use chrono::NaiveDateTime;
2use serde::{Deserialize, Serialize};
3
4use crate::dmm::{ApiResult, ElementVec};
5
6#[derive(Serialize, Debug, Default)]
7pub struct ItemListParams {
8    pub site: SiteValue,
9    pub service: Option<String>,
10    pub floor: Option<String>,
11    pub hits: Option<i64>,
12    pub offset: Option<i64>,
13    pub sort: Option<SortValue>,
14    pub keyword: Option<String>,
15    pub cid: Option<String>,
16    pub article: Option<ArticleValue>,
17    pub article_id: Option<String>,
18    pub gte_date: Option<NaiveDateTime>,
19    pub lte_date: Option<NaiveDateTime>,
20    pub mono_stock: Option<MonoStockValue>,
21}
22
23#[derive(Serialize, Debug)]
24#[serde(rename_all = "lowercase")]
25pub enum SortValue {
26    Rank,
27    Price,
28    #[serde(rename = "-price")]
29    PriceDesc,
30    Date,
31    Review,
32    Match,
33}
34
35#[derive(Serialize, Debug)]
36#[serde(rename_all = "lowercase")]
37pub enum ArticleValue {
38    Actress,
39    Author,
40    Genre,
41    Series,
42    Maker,
43}
44
45#[derive(Serialize, Debug)]
46#[serde(rename_all = "snake_case")]
47pub enum MonoStockValue {
48    Stock,
49    Reserve,
50    ReserveEmpty,
51    Mono,
52    Dmp,
53}
54
55#[derive(Serialize, Debug, Default)]
56pub enum SiteValue {
57    #[serde(rename = "FANZA")]
58    Fanza,
59    #[default]
60    #[serde(rename = "DMM.com")]
61    Dmm,
62}
63
64#[derive(Deserialize, Debug)]
65pub struct ItemListResult {
66    pub status: i64,
67    pub result_count: i64,
68    pub total_count: i64,
69    pub first_position: i64,
70    pub items: ElementVec<Item>,
71}
72impl ApiResult for ItemListResult {}
73
74#[derive(Deserialize, Debug)]
75// #[serde(deny_unknown_fields)]
76pub struct Item {
77    pub service_code: String,
78    pub service_name: String,
79    pub floor_code: String,
80    pub floor_name: String,
81    pub category_name: String,
82    pub content_id: String,
83    pub product_id: Option<String>,
84    pub title: String,
85    pub volume: Option<String>,
86    pub number: Option<String>,
87    pub review: Option<Review>,
88    #[serde(rename = "URL")]
89    pub url: String,
90    #[serde(rename = "affiliateURL")]
91    pub affiliate_url: Option<String>,
92    #[serde(rename = "imageURL")]
93    pub image_url: Option<ImageUrl>,
94    pub tachiyomi: Option<Tachiyomi>,
95    #[serde(rename = "sampleImageURL")]
96    pub sample_image_url: Option<SampleImageUrl>,
97    #[serde(rename = "sampleMovieURL")]
98    pub sample_movie_url: Option<SampleMovieUrl>,
99    pub prices: Prices,
100    pub date: Option<String>, // datetime?
101    pub iteminfo: Option<Iteminfo>,
102    pub cdinfo: Option<Cdinfo>,
103    pub jancode: Option<String>,
104    pub maker_product: Option<String>,
105    pub isbn: Option<String>,
106    // pub stock: Option<StockValue>,
107    pub stock: Option<String>, // dmm: found return '1'
108    pub directory: Option<ElementVec<Directory>>,
109    pub campaign: Option<Campaign>,
110}
111
112#[derive(Deserialize, Debug)]
113#[serde(rename_all = "snake_case")]
114pub enum StockValue {
115    Stock,
116    Reserve,
117    ReserveEmpty,
118    Mono,
119    Dmp,
120    Empty,
121}
122
123#[derive(Deserialize, Debug)]
124pub struct Review {
125    pub count: i64,
126    pub average: f64,
127}
128
129#[derive(Deserialize, Debug)]
130pub struct ImageUrl {
131    pub list: String,
132    pub small: String,
133    pub large: Option<String>,
134}
135
136#[derive(Deserialize, Debug)]
137pub struct Tachiyomi {
138    #[serde(rename = "URL")]
139    pub url: String,
140    #[serde(rename = "affiliateURL")]
141    pub affiliate_url: String,
142}
143
144#[derive(Deserialize, Debug)]
145pub struct SampleImageUrl {
146    pub sample_s: SampleS,
147    pub sample_l: Option<SampleL>,
148}
149
150#[derive(Deserialize, Debug)]
151pub struct SampleS {
152    pub image: ElementVec<String>,
153}
154#[derive(Deserialize, Debug)]
155pub struct SampleL {
156    pub image: ElementVec<String>,
157}
158
159#[derive(Deserialize, Debug)]
160pub struct SampleMovieUrl {
161    pub size_476_306: String,
162    pub size_560_360: String,
163    pub size_644_414: String,
164    pub size_720_480: String,
165    pub pc_flag: i64,
166    pub sp_flag: i64,
167}
168
169#[derive(Deserialize, Debug)]
170pub struct Prices {
171    pub price: String,
172    pub list_price: Option<String>,
173}
174
175#[derive(Deserialize, Debug)]
176pub struct Deliveries {
177    pub delivery: ElementVec<Delivery>,
178}
179
180#[derive(Deserialize, Debug)]
181pub struct Delivery {
182    pub r#type: String,
183    pub price: String,
184}
185
186#[derive(Deserialize, Debug)]
187pub struct Iteminfo {
188    pub genre: Option<ElementVec<Genre>>,
189    pub series: Option<ElementVec<Series>>,
190    pub maker: Option<ElementVec<Maker>>,
191    pub actor: Option<ElementVec<Actor>>,
192    pub actress: Option<ElementVec<Actress>>,
193    pub director: Option<ElementVec<Director>>,
194    pub author: Option<ElementVec<Author>>,
195    pub label: Option<ElementVec<Label>>,
196    pub r#type: Option<ElementVec<Type>>,
197    pub color: Option<ElementVec<Color>>,
198    pub size: Option<ElementVec<Size>>,
199}
200
201#[derive(Deserialize, Debug)]
202pub struct Genre {
203    pub name: String,
204    pub id: String,
205}
206#[derive(Deserialize, Debug)]
207pub struct Series {
208    pub name: String,
209    pub id: String,
210}
211#[derive(Deserialize, Debug)]
212pub struct Maker {
213    pub name: String,
214    pub id: String,
215}
216#[derive(Deserialize, Debug)]
217pub struct Actor {
218    pub name: String,
219    pub id: String,
220}
221#[derive(Deserialize, Debug)]
222pub struct Actress {
223    pub name: String,
224    pub ruby: String,
225    pub id: String,
226}
227#[derive(Deserialize, Debug)]
228pub struct Director {
229    pub name: String,
230    pub id: String,
231}
232#[derive(Deserialize, Debug)]
233pub struct Author {
234    pub name: String,
235    pub id: String,
236}
237#[derive(Deserialize, Debug)]
238pub struct Label {
239    pub name: String,
240    pub id: String,
241}
242#[derive(Deserialize, Debug)]
243pub struct Type {
244    pub name: String,
245    pub id: String,
246}
247#[derive(Deserialize, Debug)]
248pub struct Color {
249    pub name: String,
250    pub id: String,
251}
252#[derive(Deserialize, Debug)]
253pub struct Size {
254    pub name: String,
255    pub id: String,
256}
257
258#[derive(Deserialize, Debug)]
259pub struct Cdinfo {
260    pub king: String,
261}
262
263#[derive(Deserialize, Debug)]
264pub struct Directory {
265    pub id: String,
266    pub name: String,
267}
268
269#[derive(Deserialize, Debug)]
270pub struct Campaign {
271    pub date_begin: Option<NaiveDateTime>,
272    pub date_end: Option<NaiveDateTime>,
273    pub title: Option<String>,
274}