mod response;
mod types;
pub use response::{ChannelTeamsResponse, TeamsResponse};
pub use types::{BroadcasterTeam, Team, TeamUser};
use crate::{
request::TwitchAPIRequest,
types::{
constants::{BROADCASTER_ID, CHANNEL, ID, NAME, TEAMS},
BroadcasterId, TeamId,
},
TwitchAPI,
};
pub trait TeamsAPI {
fn get_channel_teams(
&self,
broadcaster_id: &BroadcasterId,
) -> TwitchAPIRequest<ChannelTeamsResponse>;
fn get_teams_by_name(&self, name: &str) -> TwitchAPIRequest<TeamsResponse>;
fn get_teams_by_id(&self, id: &TeamId) -> TwitchAPIRequest<TeamsResponse>;
}
impl TeamsAPI for TwitchAPI {
simple_endpoint!(
fn get_channel_teams(
broadcaster_id: &BroadcasterId [key = BROADCASTER_ID],
) -> ChannelTeamsResponse;
endpoint: GetChannelTeams,
method: GET,
path: [TEAMS, CHANNEL],
);
simple_endpoint!(
fn get_teams_by_name(
name: &str [key = NAME]
) -> TeamsResponse;
endpoint: GetTeams,
method: GET,
path: [TEAMS],
);
simple_endpoint!(
fn get_teams_by_id(
id: &TeamId [key = ID]
) -> TeamsResponse;
endpoint: GetTeams,
method: GET,
path: [TEAMS],
);
}