async_openai_wasm/
invites.rsuse serde::Serialize;
use crate::{
config::Config,
error::OpenAIError,
types::{Invite, InviteDeleteResponse, InviteListResponse, InviteRequest},
Client,
};
pub struct Invites<'c, C: Config> {
client: &'c Client<C>,
}
impl<'c, C: Config> Invites<'c, C> {
pub fn new(client: &'c Client<C>) -> Self {
Self { client }
}
pub async fn list<Q>(&self, query: &Q) -> Result<InviteListResponse, OpenAIError>
where
Q: Serialize + ?Sized,
{
self.client
.get_with_query("/organization/invites", query)
.await
}
pub async fn retrieve(&self, invite_id: &str) -> Result<Invite, OpenAIError> {
self.client
.get(format!("/organization/invites/{invite_id}").as_str())
.await
}
pub async fn create(&self, request: InviteRequest) -> Result<Invite, OpenAIError> {
self.client.post("/organization/invites", request).await
}
pub async fn delete(&self, invite_id: &str) -> Result<InviteDeleteResponse, OpenAIError> {
self.client
.delete(format!("/organization/invites/{invite_id}").as_str())
.await
}
}