use super::*;
use hconf::ShotGridAuth;
use shotgrid_rs::Client;
pub async fn shotgrid_client(auth: ShotGridAuth) -> Result<Client, DatabaseError> {
match Client::new(
auth.url.to_string(),
Some(&auth.script_name),
Some(&auth.script_key),
) {
Ok(client) => {
match client.authenticate_script().await {
Ok(_session) => {
info!("Successfully authenticated ShotGrid");
Ok(client)
}
Err(e) => Err(DatabaseError::ShotGridAuthenticationError(e.to_string())),
}
}
Err(e) => Err(DatabaseError::ShotGridClientError(e.to_string())),
}
}
#[cfg(feature = "shotgrid_async_test")]
#[cfg(test)]
mod tests {
}