1#[allow(unused_imports)]
9use alloc::collections::BTreeMap;
10
11#[allow(unused_imports)]
12use core::marker::PhantomData;
13use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr};
14
15#[allow(unused_imports)]
16use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
17use jacquard_common::deps::smol_str::SmolStr;
18use jacquard_common::types::string::Did;
19use jacquard_common::types::value::Data;
20use jacquard_derive::IntoStatic;
21use jacquard_lexicon::lexicon::LexiconDoc;
22use jacquard_lexicon::schema::LexiconSchema;
23
24use crate::games_gamesgamesgamesgames::get_contribution_stats;
25#[allow(unused_imports)]
26use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
27use serde::{Deserialize, Serialize};
28
29#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
30#[serde(
31 rename_all = "camelCase",
32 bound(deserialize = "S: Deserialize<'de> + BosStr")
33)]
34pub struct Badge<S: BosStr = DefaultStr> {
35 #[serde(skip_serializing_if = "Option::is_none")]
36 pub description: Option<S>,
37 pub id: S,
38 pub name: S,
39 #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
40 pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
41}
42
43#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
44#[serde(
45 rename_all = "camelCase",
46 bound(deserialize = "S: Deserialize<'de> + BosStr")
47)]
48pub struct ContributionStats<S: BosStr = DefaultStr> {
49 pub additions: i64,
50 pub corrections: i64,
51 pub new_games: i64,
52 pub owner_accepted: i64,
53 pub total_contributions: i64,
54 pub unique_entities: i64,
55 #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
56 pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
57}
58
59#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
60#[serde(
61 rename_all = "camelCase",
62 bound(deserialize = "S: Deserialize<'de> + BosStr")
63)]
64pub struct GetContributionStats<S: BosStr = DefaultStr> {
65 pub did: Did<S>,
66}
67
68#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
69#[serde(
70 rename_all = "camelCase",
71 bound(deserialize = "S: Deserialize<'de> + BosStr")
72)]
73pub struct GetContributionStatsOutput<S: BosStr = DefaultStr> {
74 pub badges: Vec<get_contribution_stats::Badge<S>>,
75 pub stats: get_contribution_stats::ContributionStats<S>,
76 #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
77 pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
78}
79
80impl<S: BosStr> LexiconSchema for Badge<S> {
81 fn nsid() -> &'static str {
82 "games.gamesgamesgamesgames.getContributionStats"
83 }
84 fn def_name() -> &'static str {
85 "badge"
86 }
87 fn lexicon_doc() -> LexiconDoc<'static> {
88 lexicon_doc_games_gamesgamesgamesgames_getContributionStats()
89 }
90 fn validate(&self) -> Result<(), ConstraintError> {
91 Ok(())
92 }
93}
94
95impl<S: BosStr> LexiconSchema for ContributionStats<S> {
96 fn nsid() -> &'static str {
97 "games.gamesgamesgamesgames.getContributionStats"
98 }
99 fn def_name() -> &'static str {
100 "contributionStats"
101 }
102 fn lexicon_doc() -> LexiconDoc<'static> {
103 lexicon_doc_games_gamesgamesgamesgames_getContributionStats()
104 }
105 fn validate(&self) -> Result<(), ConstraintError> {
106 Ok(())
107 }
108}
109
110pub struct GetContributionStatsResponse;
114impl jacquard_common::xrpc::XrpcResp for GetContributionStatsResponse {
115 const NSID: &'static str = "games.gamesgamesgamesgames.getContributionStats";
116 const ENCODING: &'static str = "application/json";
117 type Output<S: BosStr> = GetContributionStatsOutput<S>;
118 type Err = jacquard_common::xrpc::GenericError;
119}
120
121impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for GetContributionStats<S> {
122 const NSID: &'static str = "games.gamesgamesgamesgames.getContributionStats";
123 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
124 type Response = GetContributionStatsResponse;
125}
126
127pub struct GetContributionStatsRequest;
131impl jacquard_common::xrpc::XrpcEndpoint for GetContributionStatsRequest {
132 const PATH: &'static str = "/xrpc/games.gamesgamesgamesgames.getContributionStats";
133 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
134 type Request<S: BosStr> = GetContributionStats<S>;
135 type Response = GetContributionStatsResponse;
136}
137
138fn lexicon_doc_games_gamesgamesgamesgames_getContributionStats() -> LexiconDoc<'static> {
139 use alloc::collections::BTreeMap;
140 #[allow(unused_imports)]
141 use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
142 use jacquard_lexicon::lexicon::*;
143 LexiconDoc {
144 lexicon: Lexicon::Lexicon1,
145 id: CowStr::new_static("games.gamesgamesgamesgames.getContributionStats"),
146 defs: {
147 let mut map = BTreeMap::new();
148 map.insert(
149 SmolStr::new_static("badge"),
150 LexUserType::Object(LexObject {
151 required: Some(vec![SmolStr::new_static("id"), SmolStr::new_static("name")]),
152 properties: {
153 #[allow(unused_mut)]
154 let mut map = BTreeMap::new();
155 map.insert(
156 SmolStr::new_static("description"),
157 LexObjectProperty::String(LexString {
158 ..Default::default()
159 }),
160 );
161 map.insert(
162 SmolStr::new_static("id"),
163 LexObjectProperty::String(LexString {
164 ..Default::default()
165 }),
166 );
167 map.insert(
168 SmolStr::new_static("name"),
169 LexObjectProperty::String(LexString {
170 ..Default::default()
171 }),
172 );
173 map
174 },
175 ..Default::default()
176 }),
177 );
178 map.insert(
179 SmolStr::new_static("contributionStats"),
180 LexUserType::Object(LexObject {
181 required: Some(vec![
182 SmolStr::new_static("totalContributions"),
183 SmolStr::new_static("corrections"),
184 SmolStr::new_static("additions"),
185 SmolStr::new_static("newGames"),
186 SmolStr::new_static("uniqueEntities"),
187 SmolStr::new_static("ownerAccepted"),
188 ]),
189 properties: {
190 #[allow(unused_mut)]
191 let mut map = BTreeMap::new();
192 map.insert(
193 SmolStr::new_static("additions"),
194 LexObjectProperty::Integer(LexInteger {
195 ..Default::default()
196 }),
197 );
198 map.insert(
199 SmolStr::new_static("corrections"),
200 LexObjectProperty::Integer(LexInteger {
201 ..Default::default()
202 }),
203 );
204 map.insert(
205 SmolStr::new_static("newGames"),
206 LexObjectProperty::Integer(LexInteger {
207 ..Default::default()
208 }),
209 );
210 map.insert(
211 SmolStr::new_static("ownerAccepted"),
212 LexObjectProperty::Integer(LexInteger {
213 ..Default::default()
214 }),
215 );
216 map.insert(
217 SmolStr::new_static("totalContributions"),
218 LexObjectProperty::Integer(LexInteger {
219 ..Default::default()
220 }),
221 );
222 map.insert(
223 SmolStr::new_static("uniqueEntities"),
224 LexObjectProperty::Integer(LexInteger {
225 ..Default::default()
226 }),
227 );
228 map
229 },
230 ..Default::default()
231 }),
232 );
233 map.insert(
234 SmolStr::new_static("main"),
235 LexUserType::XrpcQuery(LexXrpcQuery {
236 parameters: Some(LexXrpcQueryParameter::Params(LexXrpcParameters {
237 required: Some(vec![SmolStr::new_static("did")]),
238 properties: {
239 #[allow(unused_mut)]
240 let mut map = BTreeMap::new();
241 map.insert(
242 SmolStr::new_static("did"),
243 LexXrpcParametersProperty::String(LexString {
244 format: Some(LexStringFormat::Did),
245 ..Default::default()
246 }),
247 );
248 map
249 },
250 ..Default::default()
251 })),
252 ..Default::default()
253 }),
254 );
255 map
256 },
257 ..Default::default()
258 }
259}
260
261pub mod contribution_stats_state {
262
263 pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
264 #[allow(unused)]
265 use ::core::marker::PhantomData;
266 mod sealed {
267 pub trait Sealed {}
268 }
269 pub trait State: sealed::Sealed {
271 type Additions;
272 type Corrections;
273 type NewGames;
274 type OwnerAccepted;
275 type TotalContributions;
276 type UniqueEntities;
277 }
278 pub struct Empty(());
280 impl sealed::Sealed for Empty {}
281 impl State for Empty {
282 type Additions = Unset;
283 type Corrections = Unset;
284 type NewGames = Unset;
285 type OwnerAccepted = Unset;
286 type TotalContributions = Unset;
287 type UniqueEntities = Unset;
288 }
289 pub struct SetAdditions<St: State = Empty>(PhantomData<fn() -> St>);
291 impl<St: State> sealed::Sealed for SetAdditions<St> {}
292 impl<St: State> State for SetAdditions<St> {
293 type Additions = Set<members::additions>;
294 type Corrections = St::Corrections;
295 type NewGames = St::NewGames;
296 type OwnerAccepted = St::OwnerAccepted;
297 type TotalContributions = St::TotalContributions;
298 type UniqueEntities = St::UniqueEntities;
299 }
300 pub struct SetCorrections<St: State = Empty>(PhantomData<fn() -> St>);
302 impl<St: State> sealed::Sealed for SetCorrections<St> {}
303 impl<St: State> State for SetCorrections<St> {
304 type Additions = St::Additions;
305 type Corrections = Set<members::corrections>;
306 type NewGames = St::NewGames;
307 type OwnerAccepted = St::OwnerAccepted;
308 type TotalContributions = St::TotalContributions;
309 type UniqueEntities = St::UniqueEntities;
310 }
311 pub struct SetNewGames<St: State = Empty>(PhantomData<fn() -> St>);
313 impl<St: State> sealed::Sealed for SetNewGames<St> {}
314 impl<St: State> State for SetNewGames<St> {
315 type Additions = St::Additions;
316 type Corrections = St::Corrections;
317 type NewGames = Set<members::new_games>;
318 type OwnerAccepted = St::OwnerAccepted;
319 type TotalContributions = St::TotalContributions;
320 type UniqueEntities = St::UniqueEntities;
321 }
322 pub struct SetOwnerAccepted<St: State = Empty>(PhantomData<fn() -> St>);
324 impl<St: State> sealed::Sealed for SetOwnerAccepted<St> {}
325 impl<St: State> State for SetOwnerAccepted<St> {
326 type Additions = St::Additions;
327 type Corrections = St::Corrections;
328 type NewGames = St::NewGames;
329 type OwnerAccepted = Set<members::owner_accepted>;
330 type TotalContributions = St::TotalContributions;
331 type UniqueEntities = St::UniqueEntities;
332 }
333 pub struct SetTotalContributions<St: State = Empty>(PhantomData<fn() -> St>);
335 impl<St: State> sealed::Sealed for SetTotalContributions<St> {}
336 impl<St: State> State for SetTotalContributions<St> {
337 type Additions = St::Additions;
338 type Corrections = St::Corrections;
339 type NewGames = St::NewGames;
340 type OwnerAccepted = St::OwnerAccepted;
341 type TotalContributions = Set<members::total_contributions>;
342 type UniqueEntities = St::UniqueEntities;
343 }
344 pub struct SetUniqueEntities<St: State = Empty>(PhantomData<fn() -> St>);
346 impl<St: State> sealed::Sealed for SetUniqueEntities<St> {}
347 impl<St: State> State for SetUniqueEntities<St> {
348 type Additions = St::Additions;
349 type Corrections = St::Corrections;
350 type NewGames = St::NewGames;
351 type OwnerAccepted = St::OwnerAccepted;
352 type TotalContributions = St::TotalContributions;
353 type UniqueEntities = Set<members::unique_entities>;
354 }
355 #[allow(non_camel_case_types)]
357 pub mod members {
358 pub struct additions(());
360 pub struct corrections(());
362 pub struct new_games(());
364 pub struct owner_accepted(());
366 pub struct total_contributions(());
368 pub struct unique_entities(());
370 }
371}
372
373pub struct ContributionStatsBuilder<St: contribution_stats_state::State, S: BosStr = DefaultStr> {
375 _state: PhantomData<fn() -> St>,
376 _fields: (
377 Option<i64>,
378 Option<i64>,
379 Option<i64>,
380 Option<i64>,
381 Option<i64>,
382 Option<i64>,
383 ),
384 _type: PhantomData<fn() -> S>,
385}
386
387impl ContributionStats<DefaultStr> {
388 pub fn new() -> ContributionStatsBuilder<contribution_stats_state::Empty, DefaultStr> {
390 ContributionStatsBuilder::new()
391 }
392}
393
394impl<S: BosStr> ContributionStats<S> {
395 pub fn builder() -> ContributionStatsBuilder<contribution_stats_state::Empty, S> {
397 ContributionStatsBuilder::builder()
398 }
399}
400
401impl ContributionStatsBuilder<contribution_stats_state::Empty, DefaultStr> {
402 pub fn new() -> Self {
404 ContributionStatsBuilder {
405 _state: PhantomData,
406 _fields: (None, None, None, None, None, None),
407 _type: PhantomData,
408 }
409 }
410}
411
412impl<S: BosStr> ContributionStatsBuilder<contribution_stats_state::Empty, S> {
413 pub fn builder() -> Self {
415 ContributionStatsBuilder {
416 _state: PhantomData,
417 _fields: (None, None, None, None, None, None),
418 _type: PhantomData,
419 }
420 }
421}
422
423impl<St, S: BosStr> ContributionStatsBuilder<St, S>
424where
425 St: contribution_stats_state::State,
426 St::Additions: contribution_stats_state::IsUnset,
427{
428 pub fn additions(
430 mut self,
431 value: impl Into<i64>,
432 ) -> ContributionStatsBuilder<contribution_stats_state::SetAdditions<St>, S> {
433 self._fields.0 = Option::Some(value.into());
434 ContributionStatsBuilder {
435 _state: PhantomData,
436 _fields: self._fields,
437 _type: PhantomData,
438 }
439 }
440}
441
442impl<St, S: BosStr> ContributionStatsBuilder<St, S>
443where
444 St: contribution_stats_state::State,
445 St::Corrections: contribution_stats_state::IsUnset,
446{
447 pub fn corrections(
449 mut self,
450 value: impl Into<i64>,
451 ) -> ContributionStatsBuilder<contribution_stats_state::SetCorrections<St>, S> {
452 self._fields.1 = Option::Some(value.into());
453 ContributionStatsBuilder {
454 _state: PhantomData,
455 _fields: self._fields,
456 _type: PhantomData,
457 }
458 }
459}
460
461impl<St, S: BosStr> ContributionStatsBuilder<St, S>
462where
463 St: contribution_stats_state::State,
464 St::NewGames: contribution_stats_state::IsUnset,
465{
466 pub fn new_games(
468 mut self,
469 value: impl Into<i64>,
470 ) -> ContributionStatsBuilder<contribution_stats_state::SetNewGames<St>, S> {
471 self._fields.2 = Option::Some(value.into());
472 ContributionStatsBuilder {
473 _state: PhantomData,
474 _fields: self._fields,
475 _type: PhantomData,
476 }
477 }
478}
479
480impl<St, S: BosStr> ContributionStatsBuilder<St, S>
481where
482 St: contribution_stats_state::State,
483 St::OwnerAccepted: contribution_stats_state::IsUnset,
484{
485 pub fn owner_accepted(
487 mut self,
488 value: impl Into<i64>,
489 ) -> ContributionStatsBuilder<contribution_stats_state::SetOwnerAccepted<St>, S> {
490 self._fields.3 = Option::Some(value.into());
491 ContributionStatsBuilder {
492 _state: PhantomData,
493 _fields: self._fields,
494 _type: PhantomData,
495 }
496 }
497}
498
499impl<St, S: BosStr> ContributionStatsBuilder<St, S>
500where
501 St: contribution_stats_state::State,
502 St::TotalContributions: contribution_stats_state::IsUnset,
503{
504 pub fn total_contributions(
506 mut self,
507 value: impl Into<i64>,
508 ) -> ContributionStatsBuilder<contribution_stats_state::SetTotalContributions<St>, S> {
509 self._fields.4 = Option::Some(value.into());
510 ContributionStatsBuilder {
511 _state: PhantomData,
512 _fields: self._fields,
513 _type: PhantomData,
514 }
515 }
516}
517
518impl<St, S: BosStr> ContributionStatsBuilder<St, S>
519where
520 St: contribution_stats_state::State,
521 St::UniqueEntities: contribution_stats_state::IsUnset,
522{
523 pub fn unique_entities(
525 mut self,
526 value: impl Into<i64>,
527 ) -> ContributionStatsBuilder<contribution_stats_state::SetUniqueEntities<St>, S> {
528 self._fields.5 = Option::Some(value.into());
529 ContributionStatsBuilder {
530 _state: PhantomData,
531 _fields: self._fields,
532 _type: PhantomData,
533 }
534 }
535}
536
537impl<St, S: BosStr> ContributionStatsBuilder<St, S>
538where
539 St: contribution_stats_state::State,
540 St::Additions: contribution_stats_state::IsSet,
541 St::Corrections: contribution_stats_state::IsSet,
542 St::NewGames: contribution_stats_state::IsSet,
543 St::OwnerAccepted: contribution_stats_state::IsSet,
544 St::TotalContributions: contribution_stats_state::IsSet,
545 St::UniqueEntities: contribution_stats_state::IsSet,
546{
547 pub fn build(self) -> ContributionStats<S> {
549 ContributionStats {
550 additions: self._fields.0.unwrap(),
551 corrections: self._fields.1.unwrap(),
552 new_games: self._fields.2.unwrap(),
553 owner_accepted: self._fields.3.unwrap(),
554 total_contributions: self._fields.4.unwrap(),
555 unique_entities: self._fields.5.unwrap(),
556 extra_data: Default::default(),
557 }
558 }
559 pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> ContributionStats<S> {
561 ContributionStats {
562 additions: self._fields.0.unwrap(),
563 corrections: self._fields.1.unwrap(),
564 new_games: self._fields.2.unwrap(),
565 owner_accepted: self._fields.3.unwrap(),
566 total_contributions: self._fields.4.unwrap(),
567 unique_entities: self._fields.5.unwrap(),
568 extra_data: Some(extra_data),
569 }
570 }
571}
572
573pub mod get_contribution_stats_state {
574
575 pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
576 #[allow(unused)]
577 use ::core::marker::PhantomData;
578 mod sealed {
579 pub trait Sealed {}
580 }
581 pub trait State: sealed::Sealed {
583 type Did;
584 }
585 pub struct Empty(());
587 impl sealed::Sealed for Empty {}
588 impl State for Empty {
589 type Did = Unset;
590 }
591 pub struct SetDid<St: State = Empty>(PhantomData<fn() -> St>);
593 impl<St: State> sealed::Sealed for SetDid<St> {}
594 impl<St: State> State for SetDid<St> {
595 type Did = Set<members::did>;
596 }
597 #[allow(non_camel_case_types)]
599 pub mod members {
600 pub struct did(());
602 }
603}
604
605pub struct GetContributionStatsBuilder<
607 St: get_contribution_stats_state::State,
608 S: BosStr = DefaultStr,
609> {
610 _state: PhantomData<fn() -> St>,
611 _fields: (Option<Did<S>>,),
612 _type: PhantomData<fn() -> S>,
613}
614
615impl GetContributionStats<DefaultStr> {
616 pub fn new() -> GetContributionStatsBuilder<get_contribution_stats_state::Empty, DefaultStr> {
618 GetContributionStatsBuilder::new()
619 }
620}
621
622impl<S: BosStr> GetContributionStats<S> {
623 pub fn builder() -> GetContributionStatsBuilder<get_contribution_stats_state::Empty, S> {
625 GetContributionStatsBuilder::builder()
626 }
627}
628
629impl GetContributionStatsBuilder<get_contribution_stats_state::Empty, DefaultStr> {
630 pub fn new() -> Self {
632 GetContributionStatsBuilder {
633 _state: PhantomData,
634 _fields: (None,),
635 _type: PhantomData,
636 }
637 }
638}
639
640impl<S: BosStr> GetContributionStatsBuilder<get_contribution_stats_state::Empty, S> {
641 pub fn builder() -> Self {
643 GetContributionStatsBuilder {
644 _state: PhantomData,
645 _fields: (None,),
646 _type: PhantomData,
647 }
648 }
649}
650
651impl<St, S: BosStr> GetContributionStatsBuilder<St, S>
652where
653 St: get_contribution_stats_state::State,
654 St::Did: get_contribution_stats_state::IsUnset,
655{
656 pub fn did(
658 mut self,
659 value: impl Into<Did<S>>,
660 ) -> GetContributionStatsBuilder<get_contribution_stats_state::SetDid<St>, S> {
661 self._fields.0 = Option::Some(value.into());
662 GetContributionStatsBuilder {
663 _state: PhantomData,
664 _fields: self._fields,
665 _type: PhantomData,
666 }
667 }
668}
669
670impl<St, S: BosStr> GetContributionStatsBuilder<St, S>
671where
672 St: get_contribution_stats_state::State,
673 St::Did: get_contribution_stats_state::IsSet,
674{
675 pub fn build(self) -> GetContributionStats<S> {
677 GetContributionStats {
678 did: self._fields.0.unwrap(),
679 }
680 }
681}