brawl_api/constants.rs
1//! Contains constant values used within the lib.
2
3/// The initial URL path to the Brawl Stars API v1.
4pub const API_URI: &str = "https://api.brawlstars.com/v1/";
5
6/// The user agent to use indicating this lib was used to request.
7pub const USER_AGENT: &str = concat!(
8 "Rust (brawl-api crate, ", env!("CARGO_PKG_VERSION"),
9 " - https://github.com/PgBiel/rust-brawl-api)"
10);
11
12/// The format used in [`TimeLike.parse`]. (Feature-gated with the `chrono` feature)
13///
14/// `"%Y%m%dT%H%M%S%.fZ"`
15///
16/// See [this table] for more info.
17///
18/// [`TimeLike.parse`]: ../time/struct.TimeLike.html#method.parse
19/// [this table]: https://docs.rs/chrono/*/chrono/format/strftime/index.html
20#[cfg(feature = "chrono")]
21pub const TIMELIKE_FORMAT: &str = "%Y%m%dT%H%M%S%.fZ";
22
23/// This eunm is an effort to aid the programmer's usage of brawler-related endpoints, by mapping
24/// human-readable brawler names to their respective IDs. (Use by casting to int; e.g. `x as usize`)
25///
26/// This is by no means a final enum and must be updated on every new Brawler release.
27///
28/// If a permanently up-to-date list is needed, one can fetch the `/brawlers/` endpoint using
29/// the available models. If still using this enum, though, rest assured that we will do our best
30/// to keep it updated - if it is not, why not contribute with a PR? ;)
31#[non_exhaustive]
32#[derive(Copy, Debug, Clone, Hash, PartialEq, Eq)]
33pub enum Brawlers {
34 Shelly = 16000000,
35 Colt = 16000001,
36 Bull = 16000002,
37 Brock = 16000003,
38 Rico = 16000004,
39 Spike = 16000005,
40 Barley = 16000006,
41 Jessie = 16000007,
42 Nita = 16000008,
43 Dynamike = 16000009,
44 ElPrimo = 16000010,
45 Mortis = 16000011,
46 Crow = 16000012,
47 Poco = 16000013,
48 Bo = 16000014,
49 Piper = 16000015,
50 Pam = 16000016,
51 Tara = 16000017,
52 Darryl = 16000018,
53 Penny = 16000019,
54 Frank = 16000020,
55 Gene = 16000021,
56 Tick = 16000022,
57 Leon = 16000023,
58 Rosa = 16000024,
59 Carl = 16000025,
60 Bibi = 16000026,
61 EightBit = 16000027,
62 Sandy = 16000028,
63 Bea = 16000029,
64 Emz = 16000030,
65 MrP = 16000031,
66 Max = 16000032,
67}