use crate::{
model::contacts::{AllianceContact, CharacterContact, ContactLabel, CorporationContact},
scope::{AlliancesScopes, CharactersScopes, CorporationsScopes},
Client, Error, ScopeBuilder,
};
pub struct ContactsEndpoints<'a> {
client: &'a Client,
}
impl<'a> ContactsEndpoints<'a> {
pub(super) fn new(client: &'a Client) -> Self {
Self { client }
}
define_endpoint! {
auth_get get_alliance_contacts(
access_token: &str,
alliance_id: i64
) -> Result<Vec<AllianceContact>, Error>
url = "{}/alliances/{}/contacts";
label = "contacts";
required_scopes = ScopeBuilder::new()
.alliances(AlliancesScopes::new().read_contacts())
.build();
}
define_endpoint! {
auth_get get_alliance_contact_labels(
access_token: &str,
alliance_id: i64
) -> Result<Vec<ContactLabel>, Error>
url = "{}/alliances/{}/contacts/labels";
label = "contact labels";
required_scopes = ScopeBuilder::new()
.alliances(AlliancesScopes::new().read_contacts())
.build();
}
define_endpoint! {
auth_delete delete_contacts(
access_token: &str,
character_id: i64;
contact_ids: Vec<i64>
) -> Result<(), Error>
url = "{}/characters/{}/contacts";
label = "delete contacts";
required_scopes = ScopeBuilder::new()
.characters(CharactersScopes::new().write_contacts())
.build();
}
define_endpoint! {
auth_get get_contacts(
access_token: &str,
character_id: i64
) -> Result<Vec<CharacterContact>, Error>
url = "{}/characters/{}/contacts";
label = "contacts";
required_scopes = ScopeBuilder::new()
.characters(CharactersScopes::new().read_contacts())
.build();
}
define_endpoint! {
auth_post add_contacts(
access_token: &str,
contact_ids: Vec<i64>,
character_id: i64;
standing: f64,
label_ids: Vec<i64>,
watched: bool,
) -> Result<Vec<i64>, Error>
url = "{}/characters/{}/contacts";
label = "add contacts";
required_scopes = ScopeBuilder::new()
.characters(CharactersScopes::new().write_contacts())
.build();
}
define_endpoint! {
auth_put edit_contacts(
access_token: &str,
contact_ids: Vec<i64>,
character_id: i64;
standing: f64,
label_ids: Vec<i64>,
watched: bool,
) -> Result<Vec<i64>, Error>
url = "{}/characters/{}/contacts";
label = "edit contacts";
required_scopes = ScopeBuilder::new()
.characters(CharactersScopes::new().write_contacts())
.build();
}
define_endpoint! {
auth_get get_contact_labels(
access_token: &str,
character_id: i64
) -> Result<Vec<ContactLabel>, Error>
url = "{}/characters/{}/contacts/labels";
label = "contact labels";
required_scopes = ScopeBuilder::new()
.characters(CharactersScopes::new().read_contacts())
.build();
}
define_endpoint! {
auth_get get_corporation_contacts(
access_token: &str,
corporation_id: i64
) -> Result<Vec<CorporationContact>, Error>
url = "{}/corporations/{}/contacts";
label = "contacts";
required_scopes = ScopeBuilder::new()
.corporations(CorporationsScopes::new().read_contacts())
.build();
}
define_endpoint! {
auth_get get_corporation_contact_labels(
access_token: &str,
corporation_id: i64
) -> Result<Vec<ContactLabel>, Error>
url = "{}/corporations/{}/contacts/labels";
label = "contact labels";
required_scopes = ScopeBuilder::new()
.corporations(CorporationsScopes::new().read_contacts())
.build();
}
}