-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#![cfg(feature = "blocking")] | ||
|
||
use gw2lib::Requester; | ||
use gw2lib_model::misc::worlds::World; | ||
|
||
pub mod setup; | ||
|
||
#[test] | ||
fn all() { | ||
let client = setup::setup(); | ||
let _: Vec<World> = client.all().unwrap(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,39 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use crate::*; | ||
|
||
pub type WorldId = u16; | ||
|
||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] | ||
pub enum PopulationLevel { | ||
Medium, | ||
High, | ||
VeryHigh, | ||
Full, | ||
} | ||
|
||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] | ||
pub struct World { | ||
id: WorldId, | ||
name: String, | ||
population: PopulationLevel, | ||
} | ||
|
||
impl Endpoint for World { | ||
const AUTHENTICATED: bool = false; | ||
const LOCALE: bool = true; | ||
const URL: &'static str = "v2/worlds"; | ||
const VERSION: &'static str = "2022-07-22T00:00:00.000Z"; | ||
} | ||
|
||
impl EndpointWithId for World { | ||
type IdType = WorldId; | ||
} | ||
|
||
impl BulkEndpoint for World { | ||
const ALL: bool = true; | ||
|
||
fn id(&self) -> &Self::IdType { | ||
&self.id | ||
} | ||
} |