use crate::party::{
PartyRole, PartyRoleCreate, PartyRoleSpecification, PartyRoleSpecificationCreate,
PartyRoleSpecificationUpdate, PartyRoleUpdate,
};
use super::client::TmfClient;
use super::error::Result;
use super::hub::HubOps;
use super::page::{Page, PageRequest, PageStream, paginate};
use super::patch::Patch;
use super::query::Query;
use super::resource_ops;
use super::transport::Transport;
pub const API_PATH: &str = "tmf-api/partyRoleManagement/v5";
pub const SPEC_VERSION: &str = "5.0.0";
const PARTY_ROLES: &str = "partyRole";
const PARTY_ROLE_SPECIFICATIONS: &str = "partyRoleSpecification";
#[derive(Debug, Clone)]
pub struct PartyRoleClient {
inner: TmfClient,
}
impl PartyRoleClient {
pub fn new(base_url: impl Into<String>, transport: impl Transport + 'static) -> Result<Self> {
Ok(Self {
inner: TmfClient::new(base_url, transport)?,
})
}
pub fn from_host(host: &str, transport: impl Transport + 'static) -> Result<Self> {
Self::new(
format!("{}/{API_PATH}", host.trim_end_matches('/')),
transport,
)
}
#[must_use]
pub fn inner(&self) -> &TmfClient {
&self.inner
}
resource_ops!(
PARTY_ROLES,
read = PartyRole,
create = PartyRoleCreate,
update = PartyRoleUpdate,
list = list_party_roles,
stream = stream_party_roles,
get = get_party_role,
new = create_party_role,
patch = update_party_role,
delete = delete_party_role,
doc = "a party role"
);
resource_ops!(
PARTY_ROLE_SPECIFICATIONS,
read = PartyRoleSpecification,
create = PartyRoleSpecificationCreate,
update = PartyRoleSpecificationUpdate,
list = list_party_role_specifications,
stream = stream_party_role_specifications,
get = get_party_role_specification,
new = create_party_role_specification,
patch = update_party_role_specification,
delete = delete_party_role_specification,
doc = "a party role specification"
);
}
impl HubOps for PartyRoleClient {
fn hub_client(&self) -> &TmfClient {
&self.inner
}
}