-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fixing some stuff so that earlier versions of Rust will still compile
- added #[must_use] so that callers get warned about using the api without doing anything with the functions - Added rust 1.27.0+ to the build and test matrices on travis
- Loading branch information
Showing
47 changed files
with
304 additions
and
287 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 |
---|---|---|
@@ -1,20 +1,24 @@ | ||
language: rust | ||
|
||
cache: cargo | ||
|
||
os: | ||
- linux | ||
- osx | ||
|
||
- windows | ||
rust: | ||
- stable | ||
- beta | ||
- nightly | ||
|
||
|
||
- 1.29.2 | ||
- 1.29.1 | ||
- 1.29.0 | ||
- 1.28.0 | ||
- 1.27.2 | ||
- 1.27.1 | ||
- 1.27.0 | ||
script: | ||
- cargo test --verbose --all | ||
|
||
matrix: | ||
fast_finish: true | ||
allow_failures: | ||
- rust: nightly | ||
- rust: nightly | ||
- os: osx |
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
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 was deleted.
Oops, something went wrong.
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,4 +1,4 @@ | ||
use crate::prelude::*; | ||
use ::prelude::*; | ||
|
||
gw2rs_id_u64!(AchievementId); | ||
|
||
|
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
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
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,4 +1,4 @@ | ||
use crate::prelude::*; | ||
use ::prelude::*; | ||
|
||
gw2rs_id_string!(BackstoryAnswerId); | ||
|
||
|
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,4 +1,4 @@ | ||
use crate::prelude::*; | ||
use ::prelude::*; | ||
|
||
gw2rs_id_u64!(BackstoryQuestionId); | ||
|
||
|
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,4 +1,4 @@ | ||
use crate::prelude::*; | ||
use ::prelude::*; | ||
|
||
gw2rs_id_u64!(ColorId); | ||
|
||
|
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,4 +1,4 @@ | ||
use crate::prelude::*; | ||
use ::prelude::*; | ||
|
||
gw2rs_id_u64!(ListingId); | ||
|
||
|
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,4 +1,4 @@ | ||
use crate::prelude::*; | ||
use ::prelude::*; | ||
|
||
gw2rs_id_u64!(PricesId); | ||
|
||
|
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,4 +1,4 @@ | ||
use crate::prelude::*; | ||
use ::prelude::*; | ||
|
||
gw2rs_id_u64!(GliderId); | ||
|
||
|
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,4 +1,4 @@ | ||
use crate::prelude::*; | ||
use ::prelude::*; | ||
|
||
gw2rs_id_string!(LegendId); | ||
|
||
|
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,4 +1,4 @@ | ||
use crate::prelude::*; | ||
use ::prelude::*; | ||
|
||
gw2rs_id_u64!(SpecializationId); | ||
|
||
|
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,4 +1,4 @@ | ||
use crate::prelude::*; | ||
use ::prelude::*; | ||
|
||
gw2rs_id_string!(StorySeasonId); | ||
|
||
|
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,4 +1,4 @@ | ||
use crate::prelude::*; | ||
use ::prelude::*; | ||
|
||
gw2rs_id_u64!(StoryId); | ||
|
||
|
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,4 +1,4 @@ | ||
use crate::prelude::*; | ||
use ::prelude::*; | ||
|
||
gw2rs_id_u64!(TitleId); | ||
|
||
|
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,4 +1,4 @@ | ||
use crate::prelude::*; | ||
use ::prelude::*; | ||
|
||
gw2rs_id_string!(ObjectiveId); | ||
|
||
|
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
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,64 +1,71 @@ | ||
use futures::Future; | ||
|
||
use crate::prelude::*; | ||
use ::prelude::*; | ||
|
||
impl GW2 { | ||
/// Retrieves today's daily achievements. | ||
#[must_use] | ||
pub fn daily_achievements(&self) -> impl Future<Item = DailyAchievements, Error = APIError> { | ||
let client = self.get_http_client(); | ||
let endpoint = Endpoint::AchievementsDaily; | ||
crate::internal::http::request_without_ids(client, endpoint, None, None, None) | ||
.and_then(|res| crate::internal::http::convert_to_struct::<DailyAchievements>(&res)) | ||
::internal::http::request_without_ids(client, endpoint, None, None, None) | ||
.and_then(|res| ::internal::http::convert_to_struct::<DailyAchievements>(&res)) | ||
} | ||
|
||
/// Retrieves tomorrows daily achievements. | ||
#[must_use] | ||
pub fn daily_achievements_tomorrow(&self) -> impl Future<Item = DailyAchievements, Error = APIError> { | ||
let client = self.get_http_client(); | ||
let endpoint = Endpoint::AchievementsDailyTomorrow; | ||
crate::internal::http::request_without_ids(client, endpoint, None, None, None) | ||
.and_then(|res| crate::internal::http::convert_to_struct::<DailyAchievements>(&res)) | ||
::internal::http::request_without_ids(client, endpoint, None, None, None) | ||
.and_then(|res| ::internal::http::convert_to_struct::<DailyAchievements>(&res)) | ||
} | ||
|
||
/// Fetches achievements using a slice of u64 identifiers. | ||
#[must_use] | ||
pub fn achievements_by_ids<'a>(&self, ids: &'a [u64]) -> impl Future<Item = Vec<Achievement>, Error = APIError> + 'a { | ||
let client = self.get_http_client(); | ||
let locale = self.locale(); | ||
let endpoint = Endpoint::Achievements; | ||
crate::internal::http::request_with_numeric_ids( client, endpoint, Some(ids), None, Some(locale), None) | ||
.and_then(|res| crate::internal::http::convert_to_struct::<Vec<Achievement>>(&res)) | ||
::internal::http::request_with_numeric_ids( client, endpoint, Some(ids), None, Some(locale), None) | ||
.and_then(|res| ::internal::http::convert_to_struct::<Vec<Achievement>>(&res)) | ||
} | ||
|
||
/// Retrieves the identifiers for valid achievement categories. | ||
#[must_use] | ||
pub fn achievement_categories(&self) -> impl Future<Item = Vec<u64>, Error = APIError> { | ||
let client = self.get_http_client(); | ||
let endpoint = Endpoint::AchievementsCategories; | ||
crate::internal::http::request_without_ids(client, endpoint, None, None, None) | ||
.and_then(|res| crate::internal::http::convert_to_struct::<Vec<u64>>(&res)) | ||
::internal::http::request_without_ids(client, endpoint, None, None, None) | ||
.and_then(|res| ::internal::http::convert_to_struct::<Vec<u64>>(&res)) | ||
} | ||
|
||
/// Retrieves achievement categories with the given identifiers. | ||
#[must_use] | ||
pub fn achievement_categories_by_ids<'a>(&self, ids: &'a [u64]) -> impl Future<Item = Vec<AchievementCategory>, Error = APIError> + 'a { | ||
let client = self.get_http_client(); | ||
let locale = self.locale(); | ||
let endpoint = Endpoint::AchievementsCategories; | ||
crate::internal::http::request_with_numeric_ids( client, endpoint, Some(ids), None, Some(locale), None) | ||
.and_then(|res| crate::internal::http::convert_to_struct::<Vec<AchievementCategory>>(&res)) | ||
::internal::http::request_with_numeric_ids( client, endpoint, Some(ids), None, Some(locale), None) | ||
.and_then(|res| ::internal::http::convert_to_struct::<Vec<AchievementCategory>>(&res)) | ||
} | ||
|
||
/// Retrieves valid achievement group identifiers. | ||
#[must_use] | ||
pub fn achievement_groups(&self) -> impl Future<Item = Vec<AchievementGroupId>, Error = APIError> { | ||
let client = self.get_http_client(); | ||
let endpoint = Endpoint::AchievementsGroups; | ||
crate::internal::http::request_without_ids(client, endpoint, None, None, None) | ||
.and_then(|res| crate::internal::http::convert_to_struct::<Vec<AchievementGroupId>>(&res)) | ||
::internal::http::request_without_ids(client, endpoint, None, None, None) | ||
.and_then(|res| ::internal::http::convert_to_struct::<Vec<AchievementGroupId>>(&res)) | ||
} | ||
|
||
/// Retrieves achievement groups with the given identifiers. | ||
#[must_use] | ||
pub fn achievement_groups_by_ids<'a>(&self, ids: &'a [&str]) -> impl Future<Item = Vec<AchievementGroup>, Error = APIError> + 'a { | ||
let client = self.get_http_client(); | ||
let locale = self.locale(); | ||
let endpoint = Endpoint::AchievementsGroups; | ||
crate::internal::http::request_with_string_ids(client, endpoint, Some(ids), None, Some(locale), None) | ||
.and_then(|res| crate::internal::http::convert_to_struct::<Vec<AchievementGroup>>(&res)) | ||
::internal::http::request_with_string_ids(client, endpoint, Some(ids), None, Some(locale), None) | ||
.and_then(|res| ::internal::http::convert_to_struct::<Vec<AchievementGroup>>(&res)) | ||
} | ||
} |
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,39 +1,43 @@ | ||
use futures::Future; | ||
|
||
use crate::prelude::*; | ||
use ::prelude::*; | ||
|
||
impl GW2 { | ||
/// Retrieves backstory answer identifiers. | ||
#[must_use] | ||
pub fn backstory_answers(&self) -> impl Future<Item = Vec<BackstoryAnswerId>, Error = APIError> { | ||
let client = self.get_http_client(); | ||
let endpoint = Endpoint::BackstoryAnswers; | ||
crate::internal::http::request_without_ids(client, endpoint, None, None, None) | ||
.and_then(|res| crate::internal::http::convert_to_struct::<Vec<BackstoryAnswerId>>(&res)) | ||
::internal::http::request_without_ids(client, endpoint, None, None, None) | ||
.and_then(|res| ::internal::http::convert_to_struct::<Vec<BackstoryAnswerId>>(&res)) | ||
} | ||
|
||
/// Retrieves backstory answers using the given list of identifiers. | ||
#[must_use] | ||
pub fn backstory_answers_by_ids<'a>(&self, ids: &'a [&str]) -> impl Future<Item = Vec<BackstoryAnswer>, Error = APIError> + 'a { | ||
let client = self.get_http_client(); | ||
let locale = self.locale(); | ||
let endpoint = Endpoint::BackstoryAnswers; | ||
crate::internal::http::request_with_string_ids(client, endpoint, Some(ids), None, Some(locale), None) | ||
.and_then(|res| crate::internal::http::convert_to_struct::<Vec<BackstoryAnswer>>(&res)) | ||
::internal::http::request_with_string_ids(client, endpoint, Some(ids), None, Some(locale), None) | ||
.and_then(|res| ::internal::http::convert_to_struct::<Vec<BackstoryAnswer>>(&res)) | ||
} | ||
|
||
/// Retrieves backstory question identifiers. | ||
#[must_use] | ||
pub fn backstory_questions(&self) -> impl Future<Item = Vec<BackstoryQuestionId>, Error = APIError> { | ||
let client = self.get_http_client(); | ||
let endpoint = Endpoint::BackstoryQuestions; | ||
crate::internal::http::request_without_ids(client, endpoint, None, None, None) | ||
.and_then(|res| crate::internal::http::convert_to_struct::<Vec<BackstoryQuestionId>>(&res)) | ||
::internal::http::request_without_ids(client, endpoint, None, None, None) | ||
.and_then(|res| ::internal::http::convert_to_struct::<Vec<BackstoryQuestionId>>(&res)) | ||
} | ||
|
||
/// Retrieves backstory questions using the given list of identifiers. | ||
#[must_use] | ||
pub fn backstory_questions_by_ids<'a>(&self, ids: &'a [u64]) -> impl Future<Item = Vec<BackstoryQuestion>, Error = APIError> + 'a { | ||
let client = self.get_http_client(); | ||
let locale = self.locale(); | ||
let endpoint = Endpoint::BackstoryQuestions; | ||
crate::internal::http::request_with_numeric_ids( client, endpoint, Some(ids), None, Some(locale), None) | ||
.and_then(|res| crate::internal::http::convert_to_struct::<Vec<BackstoryQuestion>>(&res)) | ||
::internal::http::request_with_numeric_ids( client, endpoint, Some(ids), None, Some(locale), None) | ||
.and_then(|res| ::internal::http::convert_to_struct::<Vec<BackstoryQuestion>>(&res)) | ||
} | ||
} |
Oops, something went wrong.