Introduced "pot" concept for isolating different apps' elements from each other. Removed tracing_setup
macro since it disabled most logging output
This commit is contained in:
parent
4f8d6ec3d0
commit
a768ce0f4e
17 changed files with 424 additions and 41 deletions
|
@ -1,8 +1,9 @@
|
|||
use anyhow::anyhow;
|
||||
use error::UbisyncError;
|
||||
use reqwest::{Client, StatusCode};
|
||||
use tracing::debug;
|
||||
use ubisync_lib::api::{
|
||||
app::{AppRegisterRequest, AppRegisterResponse},
|
||||
app::{AppRegisterRequest, AppRegisterResponse, AppCreatePotRequest},
|
||||
UbisyncRequest,
|
||||
};
|
||||
pub use ubisync_lib::*;
|
||||
|
@ -25,6 +26,7 @@ impl UbisyncClient {
|
|||
jwt_token: Option<&str>,
|
||||
application_name: &str,
|
||||
application_description: &str,
|
||||
application_type: &str,
|
||||
) -> Result<Self, UbisyncError> {
|
||||
let http_client = Client::new();
|
||||
let mut node_api_versions = http_client
|
||||
|
@ -49,6 +51,7 @@ impl UbisyncClient {
|
|||
.json(&AppRegisterRequest {
|
||||
name: application_name.to_string(),
|
||||
description: application_description.to_string(),
|
||||
app_type: application_type.to_string(),
|
||||
})
|
||||
.send()
|
||||
.await
|
||||
|
@ -74,6 +77,14 @@ impl UbisyncClient {
|
|||
})
|
||||
}
|
||||
|
||||
pub async fn create_default_pot(self) -> anyhow::Result<UbisyncClient> {
|
||||
let response = self.send(AppCreatePotRequest {
|
||||
app_type: None,
|
||||
}, ()).await?;
|
||||
debug!("Created new pot with ID {:?}", response.pot_id);
|
||||
Ok(self)
|
||||
}
|
||||
|
||||
pub async fn send<R>(
|
||||
&self,
|
||||
request: R,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue