mirror of
https://github.com/hexedtech/codemp.git
synced 2024-11-22 15:24:48 +01:00
fix(python): fix macros also for client.rs
This commit is contained in:
parent
f116f27b39
commit
f2a2892674
1 changed files with 13 additions and 8 deletions
|
@ -1,11 +1,16 @@
|
|||
use super::a_sync_allow_threads;
|
||||
use super::Client;
|
||||
use crate::workspace::Workspace;
|
||||
use crate::Client;
|
||||
use pyo3::prelude::*;
|
||||
|
||||
#[pymethods]
|
||||
impl Client {
|
||||
#[new]
|
||||
fn __new__(host: String, username: String, password: String) -> crate::errors::ConnectionResult<Self> {
|
||||
fn __new__(
|
||||
host: String,
|
||||
username: String,
|
||||
password: String,
|
||||
) -> crate::errors::ConnectionResult<Self> {
|
||||
super::tokio().block_on(Client::connect(host, username, password))
|
||||
}
|
||||
|
||||
|
@ -25,7 +30,7 @@ impl Client {
|
|||
fn pyjoin_workspace(&self, py: Python<'_>, workspace: String) -> PyResult<super::Promise> {
|
||||
tracing::info!("attempting to join the workspace {}", workspace);
|
||||
let this = self.clone();
|
||||
crate::a_sync_allow_threads!(py, this.join_workspace(workspace).await)
|
||||
a_sync_allow_threads!(py, this.join_workspace(workspace).await)
|
||||
// let this = self.clone();
|
||||
// Ok(super::Promise(Some(tokio().spawn(async move {
|
||||
// Ok(this
|
||||
|
@ -39,14 +44,14 @@ impl Client {
|
|||
fn pycreate_workspace(&self, py: Python<'_>, workspace: String) -> PyResult<super::Promise> {
|
||||
tracing::info!("attempting to create workspace {}", workspace);
|
||||
let this = self.clone();
|
||||
crate::a_sync_allow_threads!(py, this.create_workspace(workspace).await)
|
||||
a_sync_allow_threads!(py, this.create_workspace(workspace).await)
|
||||
}
|
||||
|
||||
#[pyo3(name = "delete_workspace")]
|
||||
fn pydelete_workspace(&self, py: Python<'_>, workspace: String) -> PyResult<super::Promise> {
|
||||
tracing::info!("attempting to delete workspace {}", workspace);
|
||||
let this = self.clone();
|
||||
crate::a_sync_allow_threads!(py, this.delete_workspace(workspace).await)
|
||||
a_sync_allow_threads!(py, this.delete_workspace(workspace).await)
|
||||
}
|
||||
|
||||
#[pyo3(name = "invite_to_workspace")]
|
||||
|
@ -58,7 +63,7 @@ impl Client {
|
|||
) -> PyResult<super::Promise> {
|
||||
tracing::info!("attempting to invite {user} to workspace {workspace}");
|
||||
let this = self.clone();
|
||||
crate::a_sync_allow_threads!(py, this.invite_to_workspace(workspace, user).await)
|
||||
a_sync_allow_threads!(py, this.invite_to_workspace(workspace, user).await)
|
||||
}
|
||||
|
||||
#[pyo3(name = "list_workspaces")]
|
||||
|
@ -70,7 +75,7 @@ impl Client {
|
|||
) -> PyResult<super::Promise> {
|
||||
tracing::info!("attempting to list workspaces");
|
||||
let this = self.clone();
|
||||
crate::a_sync_allow_threads!(py, this.list_workspaces(owned, invited).await)
|
||||
a_sync_allow_threads!(py, this.list_workspaces(owned, invited).await)
|
||||
}
|
||||
|
||||
#[pyo3(name = "leave_workspace")]
|
||||
|
@ -103,6 +108,6 @@ impl Client {
|
|||
fn pyrefresh(&self, py: Python<'_>) -> PyResult<super::Promise> {
|
||||
tracing::info!("attempting to refresh token");
|
||||
let this = self.clone();
|
||||
crate::a_sync_allow_threads!(py, this.refresh().await)
|
||||
a_sync_allow_threads!(py, this.refresh().await)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue