brawl_api/model/players/
battlelog.rs

1//! Contains models related to the `/players/:tag/battlelog` endpoint of the Brawl Stars API.
2//! Included by the feature `"players"`; removing that feature will disable the usage of this module.
3
4use std::ops::{Deref, DerefMut};
5use crate::traits::{GetFetchProp, PropFetchable, FetchFrom};
6use crate::http::routes::Route;
7use crate::util::{fetch_route, a_fetch_route, auto_hashtag};
8use serde::{self, Serialize, Deserialize};
9use crate::error::Result;
10use crate::serde::one_default;
11
12#[cfg(feature = "async")]
13use async_trait::async_trait;
14use crate::http::Client;
15
16use super::player::Player;
17use crate::TimeLike;
18
19// region:BattleLog
20
21/// Represents a list of a Player's most recent battles.
22/// (NOTE: It may take up to 30 minutes for a new battle to appear in the battlelog.)
23///
24/// Use [`BattleLog::fetch`] to fetch the battle logs for a given player tag.
25/// One may also [`BattleLog::fetch_from`] with an existing [`Player`] instance in order to use its
26/// tag.
27///
28/// [`BattleLog::fetch`]: #method.fetch
29/// [`BattleLog::fetch_from`]: #method.fetch_from
30/// [`Player`]: model/players/player/struct.Player.html
31#[derive(Debug, Clone, Hash, PartialEq, Eq, Serialize, Deserialize)]
32pub struct BattleLog {
33    /// The tag of the player whose BattleLog (most recent battles) was fetched.
34    #[serde(skip)]  // artificial
35    pub tag: String,
36
37    /// The items (battles) of this battle log.
38    #[serde(default)]
39    pub items: Vec<Battle>
40}
41
42impl Deref for BattleLog {
43    type Target = Vec<Battle>;
44
45    /// Obtain the player's battles - dereferencing returns the [`items`] field.
46    ///
47    /// # Examples
48    ///
49    /// ```rust,ignore
50    /// use brawl_api::{Client, BattleLog, traits::*};
51    ///
52    /// # fn main() -> Result<(), Box<dyn ::std::error::Error>> {
53    /// let client = Client::new("my auth token");
54    /// let battlelog = BattleLog::fetch(
55    ///     &client,            // <- the client containing the auth key
56    ///     "#PLAYER_TAG_HERE"  // <- the player whose battlelog should be fetched
57    /// )?;
58    ///
59    /// assert_eq!(battlelog.items, *battlelog);
60    ///
61    /// #     Ok(())
62    /// # }
63    ///
64    /// ```
65    ///
66    /// [`items`]: #structfield.items
67    fn deref(&self) -> &Vec<Battle> {
68        &self.items
69    }
70}
71
72impl DerefMut for BattleLog {
73    /// Obtain the player's battles - dereferencing returns the [`items`] field.
74    ///
75    /// # Examples
76    ///
77    /// ```rust,ignore
78    /// use brawl_api::{Client, BattleLog, traits::*};
79    ///
80    /// # fn main() -> Result<(), Box<dyn ::std::error::Error>> {
81    /// let client = Client::new("my auth token");
82    /// let battlelog = BattleLog::fetch(
83    ///     &client,            // <- the client containing the auth key
84    ///     "#PLAYER_TAG_HERE"  // <- the player whose battlelog should be fetched
85    /// )?;
86    ///
87    /// assert_eq!(battlelog.items, *battlelog);
88    ///
89    /// #     Ok(())
90    /// # }
91    ///
92    /// ```
93    ///
94    /// [`items`]: #structfield.items
95    fn deref_mut(&mut self) -> &mut Vec<Battle> {
96        &mut self.items
97    }
98}
99
100impl GetFetchProp for BattleLog {
101    type Property = str;
102
103    fn get_fetch_prop(&self) -> &str {
104        &*self.tag
105    }
106
107    fn get_route(tag: &str) -> Route {
108        Route::PlayerBattlelogs(auto_hashtag(tag))
109    }
110}
111
112#[cfg_attr(feature = "async", async_trait)]
113impl FetchFrom<Player> for BattleLog {
114    /// (Sync) Fetches a given player's battlelog (a `BattleLog` instance) by using data from
115    /// an existing [`Player`] instance. (See [`BattleLog::fetch`] for more details.)
116    ///
117    /// Note that this is simply to minimize efforts when a player was already fetched. If
118    /// no `Player` instance was previously present, it is recommended to simply `BattleLog::fetch`
119    /// with the specific player's tag.
120    ///
121    /// # Examples
122    ///
123    /// ```rust,ignore
124    /// use brawl_api::{Client, Player, BattleLog, traits::*};
125    ///
126    /// # fn main() -> Result<(), Box<dyn ::std::error::Error>> {
127    /// let my_client = Client::new("my auth token");
128    /// let player = Player::fetch(&my_client, "#PLAYERTAGHERE")?;
129    /// // do stuff with player...
130    /// let player_battlelog = BattleLog::fetch_from(&my_client, &player)?;
131    /// // now the player's battlelog is available for use
132    ///
133    /// # Ok(())
134    /// # }
135    /// ```
136    ///
137    /// [`Player`]: ../player/struct.Player.html
138    /// [`BattleLog::fetch`]: #method.fetch
139    fn fetch_from(client: &Client, player: &Player) -> Result<BattleLog> {
140        BattleLog::fetch(client, &player.tag)
141    }
142
143    /// (Async) Fetches a given player's battlelog (a `BattleLog` instance) by using data from
144    /// an existing [`Player`] instance. (See [`BattleLog::fetch`] for more details.)
145    ///
146    /// Note that this is simply to minimize efforts when a player was already fetched. If
147    /// no `Player` instance was previously present, it is recommended to simply `BattleLog::fetch`
148    /// with the specific player's tag.
149    ///
150    /// # Examples
151    ///
152    /// ```rust,ignore
153    /// use brawl_api::{Client, Player, BattleLog, traits::*};
154    ///
155    /// # async fn main() -> Result<(), Box<dyn ::std::error::Error>> {
156    /// let my_client = Client::new("my auth token");
157    /// let player = Player::a_fetch(&my_client, "#PLAYERTAGHERE").await?;
158    /// // do stuff with player...
159    /// let player_battlelog = BattleLog::a_fetch_from(&my_client, &player).await?;
160    /// // now the player's battlelog is available for use
161    ///
162    /// # Ok(())
163    /// # }
164    /// ```
165    ///
166    /// [`Player`]: ../player/struct.Player.html
167    /// [`BattleLog::fetch`]: #method.fetch
168    #[cfg(feature = "async")]
169    async fn a_fetch_from(client: &Client, player: &Player) -> Result<BattleLog> {
170        BattleLog::a_fetch(client, &player.tag).await
171    }
172}
173
174#[cfg_attr(feature = "async", async_trait)]
175impl PropFetchable for BattleLog {
176    type Property = str;
177
178    /// (Sync) Fetches a player's battlelog (most recent battles), given its tag.
179    ///
180    /// # Errors
181    ///
182    /// This function may error:
183    /// - While requesting (will return an [`Error::Request`]);
184    /// - After receiving a bad status code (API or other error - returns an [`Error::Status`]);
185    /// - After a ratelimit is indicated by the API, while also specifying when it is lifted ([`Error::Ratelimited`]);
186    /// - While parsing incoming JSON (will return an [`Error::Json`]).
187    ///
188    /// (All of those, of course, wrapped inside an `Err`.)
189    ///
190    /// # Examples
191    ///
192    /// ```rust,ignore
193    /// use brawl_api::{Client, Player, BattleLog, traits::*};
194    ///
195    /// # fn main() -> Result<(), Box<dyn ::std::error::Error>> {
196    /// let my_client = Client::new("my auth token");
197    /// let player_battlelog = BattleLog::fetch(&my_client, "#PLAYERTAGHERE")?;
198    /// // now the player's battlelog is available for use
199    ///
200    /// # Ok(())
201    /// # }
202    /// ```
203    ///
204    /// [`Error::Request`]: error/enum.Error.html#variant.Request
205    /// [`Error::Status`]: error/enum.Error.html#variant.Status
206    /// [`Error::Ratelimited`]: error/enum.Error.html#variant.Ratelimited
207    /// [`Error::Json`]: error/enum.Error.html#variant.Json
208    fn fetch(client: &Client, tag: &str) -> Result<BattleLog> {
209        let route = Self::get_route(tag);
210        let mut battle_log = fetch_route::<BattleLog>(client, &route)?;
211        battle_log.tag = tag.to_owned();
212        Ok(battle_log)
213    }
214
215    /// (Async) Fetches a player's battlelog (most recent battles), given its tag.
216    ///
217    /// # Errors
218    ///
219    /// This function may error:
220    /// - While requesting (will return an [`Error::Request`]);
221    /// - After receiving a bad status code (API or other error - returns an [`Error::Status`]);
222    /// - After a ratelimit is indicated by the API, while also specifying when it is lifted ([`Error::Ratelimited`]);
223    /// - While parsing incoming JSON (will return an [`Error::Json`]).
224    ///
225    /// (All of those, of course, wrapped inside an `Err`.)
226    ///
227    /// # Examples
228    ///
229    /// ```rust,ignore
230    /// use brawl_api::{Client, Player, BattleLog, traits::*};
231    ///
232    /// # async fn main() -> Result<(), Box<dyn ::std::error::Error>> {
233    /// let my_client = Client::new("my auth token");
234    /// let player_battlelog = BattleLog::a_fetch(&my_client, "#PLAYERTAGHERE").await?;
235    /// // now the player's battlelog is available for use
236    ///
237    /// # Ok(())
238    /// # }
239    /// ```
240    ///
241    /// [`Error::Request`]: error/enum.Error.html#variant.Request
242    /// [`Error::Status`]: error/enum.Error.html#variant.Status
243    /// [`Error::Ratelimited`]: error/enum.Error.html#variant.Ratelimited
244    /// [`Error::Json`]: error/enum.Error.html#variant.Json
245    #[cfg(feature="async")]
246    async fn a_fetch(client: &Client, tag: &'async_trait str) -> Result<BattleLog>
247        where Self: 'async_trait,
248              Self::Property: 'async_trait,
249    {
250        let route = BattleLog::get_route(tag);
251        let mut battle_log = a_fetch_route::<BattleLog>(client, &route).await?;
252        battle_log.tag = tag.to_owned();
253        Ok(battle_log)
254    }
255}
256
257// endregion:BattleLog
258
259/// Represents a Battle in a player's [`BattleLog`].
260///
261/// [`BattleLog`]: struct.BattleLog.html
262#[derive(Debug, Clone, Hash, PartialEq, Eq, Serialize, Deserialize)]
263#[serde(rename_all = "camelCase")]
264pub struct Battle {
265    /// The time at which this battle occurred, in ISO format.
266    #[serde(default)]
267    pub battle_time: TimeLike,
268
269    /// Data about the event in which this battle occurred.
270    #[serde(default)]
271    pub event: BattleEvent,
272
273    /// Data about the battle itself and its outcome.
274    #[serde(default)]
275    #[serde(rename = "battle")]
276    pub result: BattleResultInfo,
277}
278
279impl Default for Battle {
280
281    /// Returns a default `Battle` instance, with all default values initialized.
282    ///
283    /// # Examples
284    ///
285    /// ```rust
286    /// use brawl_api::{Battle, BattleEvent, BattleResultInfo, TimeLike};
287    ///
288    /// assert_eq!(
289    ///     Battle::default(),
290    ///     Battle {
291    ///         battle_time: TimeLike::default(),
292    ///         event: BattleEvent::default(),
293    ///         result: BattleResultInfo::default()
294    ///     }
295    /// )
296    /// ```
297    fn default() -> Battle {
298        Battle {
299            battle_time: TimeLike::default(),
300            event: BattleEvent::default(),
301            result: BattleResultInfo::default()
302        }
303    }
304}
305
306/// Contains data about the event played during a [`Battle`].
307///
308/// [`Battle`]: struct.Battle.html
309#[derive(Debug, Clone, Hash, PartialEq, Eq, Serialize, Deserialize)]
310pub struct BattleEvent {
311    /// The id of the event (an arbitrary number).
312    #[serde(default)]
313    pub id: usize,
314
315    /// The event mode (e.g. "brawlBall", "soloShowdown"...).
316    #[serde(default)]
317    pub mode: String,
318
319    /// The name of the map where this battle happened.
320    #[serde(default)]
321    pub map: String,
322}
323
324impl BattleEvent {
325    /// Returns a default BattleEvent - see [`BattleEvent::default`].
326    ///
327    /// [`BattleEvent::default`]: #method.default
328    pub fn new() -> BattleEvent { BattleEvent::default() }
329}
330
331impl Default for BattleEvent {
332    /// Returns a default `BattleEvent` instance, with all default values initialized.
333    ///
334    /// # Examples
335    ///
336    /// ```rust
337    /// use brawl_api::BattleEvent;
338    ///
339    /// assert_eq!(
340    ///     BattleEvent::default(),
341    ///     BattleEvent { id: 0, mode: String::from(""), map: String::from("") }
342    /// )
343    /// ```
344    fn default() -> BattleEvent {
345        BattleEvent {
346            id: 0,
347            mode: String::from(""),
348            map: String::from(""),
349        }
350    }
351}
352
353#[non_exhaustive]
354#[derive(Debug, Clone, Hash, Serialize, Deserialize, PartialEq, Eq)]
355#[serde(rename_all = "camelCase")]
356pub enum BattleOutcome {
357    Victory,
358    Defeat,
359    Draw,
360}
361
362impl ::std::fmt::Display for BattleOutcome {
363    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
364        write!(
365            f,
366            "{}",
367            match *self {
368                BattleOutcome::Victory => "Victory",
369                BattleOutcome::Defeat => "Defeat",
370                BattleOutcome::Draw => "Draw",
371            }
372        )
373    }
374}
375
376/// Represents the result of a battle in a [`Battle`] object, including details, outcome,
377/// players/teams etc.
378///
379/// There are three general models of fields here:
380///
381/// - **Team modes** (Bounty, Gem Grab, Duo Showdown...): fields `mode`, `battle_type`, `duration`,
382/// `trophy_change`, `result`, `star_player`, `teams`
383/// - **Solo modes** (Solo Showdown): fields `mode`, `battle_type`, `duration`, `trophy_change`,
384/// `rank`, `players`
385/// - **Weekend events:** Depends on the event. Should always be there: `mode`, `duration`.
386///   - Here, `trophy_change` is always equal to 0.
387///   - **Boss fight:** `mode`, `duration`, `players`
388///   - **Big Brawler:** `mode`, `duration`, `result`, `star_player`, `teams` (needs testing!)
389///   - **Robo Rumble:** `mode`, `duration`, `players` (needs testing!)
390///
391/// [`Battle`]: struct.Battle.html
392#[derive(Debug, Clone, Hash, PartialEq, Eq, Serialize, Deserialize)]
393#[serde(rename_all = "camelCase")]
394pub struct BattleResultInfo {
395    /// The event mode (e.g. "brawlBall", "soloShowdown"...). Should be the same as [`BattleEvent.mode`].
396    ///
397    /// [`BattleEvent.mode`]: ./struct.BattleEvent.html#structfield.mode
398    #[serde(default)]
399    pub mode: String,
400
401    /// The type of battle (e.g. "ranked").
402    ///
403    /// If this is `None`, then this is likely a weekend event.
404    #[serde(default)]
405    #[serde(rename = "type")]
406    pub battle_type: Option<String>,
407
408    /// The duration of this battle, in seconds.
409    #[serde(default)]
410    pub duration: usize,
411
412    /// The difference in trophies applied to the player after the battle. E.g. -4 (lost 4 trophies)
413    ///
414    /// This is always 0 for weekend events and practice.
415    #[serde(default)]
416    pub trophy_change: isize,
417
418    /// If this was a solo mode match, then this is the player's final rank (1-10). Otherwise,
419    /// `None`.
420    #[serde(default)]
421    pub rank: Option<u8>,
422
423    /// If this was a match with teams, then this is the outcome for the player
424    /// (Victory/Defeat/Draw), otherwise `None`.
425    #[serde(default)]
426    pub result: Option<BattleOutcome>,
427
428    /// The data indicating who was the Star Player in the match. This is generally from the
429    /// winning team, unless a draw occurred, in which case it can be from either team.
430    /// If this was a solo mode or boss fight match, for instance, then there is no star player
431    /// (None).
432    #[serde(default)]
433    pub star_player: Option<BattlePlayer>,
434
435    /// If this was a match with teams, then this is a vector with all teams of players
436    /// (as vectors) - this can be the teams in a teamed mode such as Bounty, or the pairs in
437    /// Duo Showdown, for example.
438    /// Otherwise, `None`.
439    #[serde(default)]
440    pub teams: Option<Vec<Vec<BattlePlayer>>>,
441
442    /// If this was a solo match or a mode without teams, such as Showdown, then this is a vector
443    /// with all the players in the match. Otherwise, `None`.
444    #[serde(default)]
445    pub players: Option<Vec<BattlePlayer>>
446}
447
448impl Default for BattleResultInfo {
449    /// Returns an instance of `BattleResultInfo` with initial values.
450    ///
451    /// # Examples
452    ///
453    /// ```rust
454    /// use brawl_api::BattleResultInfo;
455    ///
456    /// assert_eq!(
457    ///     BattleResultInfo::default(),
458    ///     BattleResultInfo {
459    ///         mode: String::from(""),
460    ///         battle_type: Some(String::from("")),
461    ///         duration: 0,
462    ///         trophy_change: 0,
463    ///         rank: None,
464    ///         star_player: None,
465    ///         result: None,
466    ///         teams: None,
467    ///         players: None,
468    ///     }
469    /// );
470    /// ```
471    fn default() -> BattleResultInfo {
472        BattleResultInfo {
473            mode: String::from(""),
474            battle_type: Some(String::from("")),
475            duration: 0,
476            trophy_change: 0,
477            rank: None,
478            star_player: None,
479            result: None,
480            teams: None,
481            players: None,
482        }
483    }
484}
485
486/// Represents a player in a [`BattleResultInfo`] object, with only partial data about it (note that
487/// the `brawler` field is exclusive to this struct, representing the brawler the player was using
488/// during the battle).
489/// One can use [`Player::fetch_from`] to obtain a full [`Player`] instance from an existing
490/// `BattlePlayer` instance.
491///
492/// [`BattleResultInfo`]: ./struct.BattleResult.html
493/// [`Player`]: ../player/struct.Player.html
494/// [`Player::fetch_from`]: ../player/struct.Player.html#method.fetch_from
495#[derive(Debug, Clone, Hash, PartialEq, Eq, Serialize, Deserialize)]
496pub struct BattlePlayer {
497    /// The player's tag.
498    #[serde(default)]
499    pub tag: String,
500
501    /// The player's name.
502    #[serde(default)]
503    pub name: String,
504
505    /// The brawler the player was using during the battle.
506    #[serde(default)]
507    pub brawler: BattleBrawler,
508}
509
510impl Default for BattlePlayer {
511    /// Returns an instance of `BattlePlayer` with initial values.
512    ///
513    /// # Examples
514    ///
515    /// ```rust
516    /// use brawl_api::{BattlePlayer, BattleBrawler};
517    ///
518    /// assert_eq!(
519    ///     BattlePlayer::default(),
520    ///     BattlePlayer {
521    ///         tag: String::from(""),
522    ///         name: String::from(""),
523    ///         brawler: BattleBrawler::default(),
524    ///     }
525    /// );
526    /// ```
527    fn default() -> BattlePlayer {
528        BattlePlayer {
529            tag: String::from(""),
530            name: String::from(""),
531            brawler: BattleBrawler::default(),
532        }
533    }
534}
535
536/// Represents the brawler a player was using in a [`BattlePlayer`] object.
537///
538/// [`BattlePlayer`]: ./struct.BattlePlayer.html
539#[derive(Debug, Clone, Hash, PartialEq, Eq, Serialize, Deserialize)]
540pub struct BattleBrawler {
541    /// The brawler's id (an arbitrary number).
542    #[serde(default)]
543    pub id: usize,
544
545    /// The brawler's name (e.g. "PENNY", "ROSA", "BROCK"...)
546    #[serde(default)]
547    pub name: String,
548
549    /// The brawler's power (1-10).
550    #[serde(default = "one_default")]
551    pub power: u8,
552
553    #[serde(default)]
554    pub trophies: usize,
555}
556
557impl Default for BattleBrawler {
558    /// Returns an instance of `BattleBrawler` with initial values.
559    ///
560    /// # Examples
561    ///
562    /// ```rust
563    /// use brawl_api::BattleBrawler;
564    ///
565    /// assert_eq!(
566    ///     BattleBrawler::default(),
567    ///     BattleBrawler {
568    ///         id: 0,
569    ///         name: String::from(""),
570    ///         power: 1,
571    ///         trophies: 0,
572    ///     }
573    /// );
574    /// ```
575    fn default() -> BattleBrawler {
576        BattleBrawler {
577            id: 0,
578            name: String::from(""),
579            power: 1,
580            trophies: 0,
581        }
582    }
583}
584
585///////////////////////////////////   tests   ///////////////////////////////////
586
587#[cfg(test)]
588mod tests {
589    use serde_json;
590    use crate::time::TimeLike;
591    use super::{
592        BattleLog, BattleBrawler, BattlePlayer, Battle, BattleResultInfo, BattleEvent, BattleOutcome
593    };
594
595    /// Tests for battlelog deserialization from API-provided JSON.
596    #[test]
597    fn battlelog_deser() -> Result<(), Box<dyn ::std::error::Error>> {
598
599        let battlelog_json_s = r##"{
600  "items": [
601    {
602      "battleTime": "20200131T003432.000Z",
603      "event": {
604        "id": 15000163,
605        "mode": "brawlBall",
606        "map": "Coarse Course"
607      },
608      "battle": {
609        "mode": "brawlBall",
610        "type": "ranked",
611        "result": "victory",
612        "duration": 96,
613        "trophyChange": 8,
614        "starPlayer": {
615          "tag": "#CCCCCCCC",
616          "name": "User",
617          "brawler": {
618            "id": 16000008,
619            "name": "NITA",
620            "power": 10,
621            "trophies": 500
622          }
623        },
624        "teams": [
625          [
626            {
627              "tag": "#CCCCCCCC",
628              "name": "User",
629              "brawler": {
630                "id": 16000008,
631                "name": "NITA",
632                "power": 10,
633                "trophies": 500
634              }
635            },
636            {
637              "tag": "#RRRAAALLL",
638              "name": "Other User",
639              "brawler": {
640                "id": 16000001,
641                "name": "COLT",
642                "power": 8,
643                "trophies": 510
644              }
645            },
646            {
647              "tag": "#GGGGGGGGG",
648              "name": "Another User",
649              "brawler": {
650                "id": 16000018,
651                "name": "DARRYL",
652                "power": 10,
653                "trophies": 520
654              }
655            }
656          ],
657          [
658            {
659              "tag": "#777777777",
660              "name": "User User User",
661              "brawler": {
662                "id": 16000032,
663                "name": "MAX",
664                "power": 10,
665                "trophies": 500
666              }
667            },
668            {
669              "tag": "#SUVSUVSUV",
670              "name": "User.User?!",
671              "brawler": {
672                "id": 16000024,
673                "name": "ROSA",
674                "power": 9,
675                "trophies": 400
676              }
677            },
678            {
679              "tag": "#QCPJ09J",
680              "name": "пользователь",
681              "brawler": {
682                "id": 16000028,
683                "name": "SANDY",
684                "power": 10,
685                "trophies": 450
686              }
687            }
688          ]
689        ]
690      }
691    }
692  ]
693}"##;
694        let battle_log = serde_json::from_str::<BattleLog>(battlelog_json_s)?;
695
696        assert_eq!(
697            battle_log,
698            BattleLog {
699                items: vec![
700                    Battle {
701                        battle_time: TimeLike(String::from("20200131T003432.000Z")),
702                        event: BattleEvent {
703                            id: 15000163,
704                            mode: String::from("brawlBall"),
705                            map: String::from("Coarse Course")
706                        },
707                        result: BattleResultInfo {
708                            mode: String::from("brawlBall"),
709                            battle_type: Some(String::from("ranked")),
710                            result: Some(BattleOutcome::Victory),
711                            duration: 96,
712                            trophy_change: 8,
713                            star_player: Some(BattlePlayer {
714                                tag: String::from("#CCCCCCCC"),
715                                name: String::from("User"),
716                                brawler: BattleBrawler {
717                                    id: 16000008,
718                                    name: String::from("NITA"),
719                                    power: 10,
720                                    trophies: 500
721                                }
722                            }),
723                            teams: Some(vec![
724                                vec![
725                                    BattlePlayer {
726                                        tag: String::from("#CCCCCCCC"),
727                                        name: String::from("User"),
728                                        brawler: BattleBrawler {
729                                            id: 16000008,
730                                            name: String::from("NITA"),
731                                            power: 10,
732                                            trophies: 500
733                                        }
734                                    },
735                                    BattlePlayer {
736                                        tag: String::from("#RRRAAALLL"),
737                                        name: String::from("Other User"),
738                                        brawler: BattleBrawler {
739                                            id: 16000001,
740                                            name: String::from("COLT"),
741                                            power: 8,
742                                            trophies: 510
743                                        }
744                                    },
745                                    BattlePlayer {
746                                        tag: String::from("#GGGGGGGGG"),
747                                        name: String::from("Another User"),
748                                        brawler: BattleBrawler {
749                                            id: 16000018,
750                                            name: String::from("DARRYL"),
751                                            power: 10,
752                                            trophies: 520
753                                        }
754                                    }
755                                ],
756                                vec![
757                                    BattlePlayer {
758                                        tag: String::from("#777777777"),
759                                        name: String::from("User User User"),
760                                        brawler: BattleBrawler {
761                                            id: 16000032,
762                                            name: String::from("MAX"),
763                                            power: 10,
764                                            trophies: 500
765                                        }
766                                    },
767                                    BattlePlayer {
768                                        tag: String::from("#SUVSUVSUV"),
769                                        name: String::from("User.User?!"),
770                                        brawler: BattleBrawler {
771                                            id: 16000024,
772                                            name: String::from("ROSA"),
773                                            power: 9,
774                                            trophies: 400
775                                        }
776                                    },
777                                    BattlePlayer {
778                                        tag: String::from("#QCPJ09J"),
779                                        name: String::from("пользователь"),
780                                        brawler: BattleBrawler {
781                                            id: 16000028,
782                                            name: String::from("SANDY"),
783                                            power: 10,
784                                            trophies: 450
785                                        }
786                                    }
787                                ]
788                            ]), ..BattleResultInfo::default()
789                        }
790                    }
791                ],
792                tag: String::from(""),
793            }
794        );
795
796        Ok(())
797    }
798}