1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
//! Team members interface
use crate::prelude::*;
use crate::types::id::{GameId, ModId};
pub use crate::types::mods::{TeamLevel, TeamMember};
/// Interface for the team members of a mod.
#[derive(Clone)]
pub struct Members {
modio: Modio,
game: GameId,
mod_id: ModId,
}
impl Members {
pub(crate) fn new(modio: Modio, game: GameId, mod_id: ModId) -> Self {
Self {
modio,
game,
mod_id,
}
}
/// Returns a `Query` interface to retrieve all team members.
///
/// See [Filters and sorting](filters).
pub fn search(&self, filter: Filter) -> Query<TeamMember> {
let route = Route::GetModTeamMembers {
game_id: self.game,
mod_id: self.mod_id,
};
Query::new(self.modio.clone(), route, filter)
}
}
/// Team member filters and sorting.
///
/// # Filters
/// - `Fulltext`
/// - `Id`
/// - `UserId`
/// - `Username`
/// - `Level`
/// - `DateAdded`
/// - `Position`
///
/// # Sorting
/// - `Id`
/// - `UserId`
/// - `Username`
///
/// See [modio docs](https://docs.mod.io/#get-mod-team-members) for more information.
///
/// By default this returns up to `100` items. You can limit the result by using `limit` and
/// `offset`.
///
/// # Example
/// ```
/// use modio::filter::prelude::*;
/// use modio::teams::filters::Id;
///
/// let filter = Id::_in(vec![1, 2]).order_by(Id::desc());
/// ```
#[rustfmt::skip]
pub mod filters {
#[doc(inline)]
pub use crate::filter::prelude::Fulltext;
#[doc(inline)]
pub use crate::filter::prelude::Id;
#[doc(inline)]
pub use crate::filter::prelude::DateAdded;
filter!(UserId, USER_ID, "user_id", Eq, NotEq, In, Cmp, OrderBy);
filter!(Username, USERNAME, "username", Eq, NotEq, In, Like, OrderBy);
filter!(Level, LEVEL, "level", Eq, NotEq, In, Cmp, OrderBy);
filter!(Position, POSITION, "position", Eq, NotEq, In, Like, OrderBy);
}