1use serde::{Deserialize, Serialize};
2use serde_with::skip_serializing_none;
3
4#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize)]
6#[serde(rename_all = "camelCase")]
7pub struct Items<C, E = ()> {
8 pub items: C,
10 #[serde(flatten)]
12 pub extra_fields: E,
13}
14
15impl<C> Items<C> {
16 pub fn new(items: C) -> Self {
18 Self {
19 items,
20 extra_fields: (),
21 }
22 }
23}
24
25impl<C, E> Items<C, E> {
26 pub fn new_with_extra_fields(items: C, extra_fields: E) -> Self {
28 Self {
29 items,
30 extra_fields,
31 }
32 }
33}
34
35impl<C, E: Default> From<C> for Items<C, E> {
36 fn from(items: C) -> Self {
37 Items {
38 items,
39 extra_fields: E::default(),
40 }
41 }
42}
43
44pub type ItemsVec<T, E = ()> = Items<Vec<T>, E>;
46
47#[derive(Clone, Debug, Default, Serialize, Deserialize)]
49#[serde(rename_all = "camelCase")]
50#[skip_serializing_none]
51pub struct Cursor {
52 pub next_cursor: Option<String>,
54}
55
56#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize)]
58#[serde(rename_all = "camelCase")]
59#[skip_serializing_none]
60pub struct IgnoreUnknownIds {
61 pub ignore_unknown_ids: bool,
63}