pub struct PulseClient { /* private fields */ }Expand description
Async HTTP client for the Pulse REST API.
§Example
use pulse_client::PulseClient;
let client = PulseClient::builder()
.base_url("http://localhost:9090")
.build()?;
client.auth().login("alice", "secret").await?;
for pipeline in client.pipelines().list().await? {
println!("{}", pipeline["name"]);
}§Thread safety
PulseClient is Clone and cheap to clone — the underlying reqwest client
pools connections, and the token sits behind an Arc<RwLock>. Share a
single instance across tasks.
Implementations§
Source§impl PulseClient
impl PulseClient
pub fn builder() -> PulseClientBuilder
Sourcepub fn token(&self) -> Option<String>
pub fn token(&self) -> Option<String>
Returns the current bearer token, or None if none is set.
Sourcepub fn set_token<S: Into<String>>(&self, token: S)
pub fn set_token<S: Into<String>>(&self, token: S)
Updates the bearer token used by subsequent authenticated requests. Safe to call from multiple tasks concurrently.
Sourcepub fn clear_token(&self)
pub fn clear_token(&self)
Clears the bearer token, effectively logging out the client.
pub fn auth(&self) -> AuthResource<'_>
pub fn pipelines(&self) -> PipelinesResource<'_>
pub fn agents(&self) -> AgentsResource<'_>
pub fn templates(&self) -> TemplatesResource<'_>
pub fn users(&self) -> UsersResource<'_>
pub fn events(&self) -> EventsResource<'_>
pub fn iq(&self) -> IQResource<'_>
Sourcepub fn streams(&self) -> StreamsResource<'_>
pub fn streams(&self) -> StreamsResource<'_>
client.streams() — B-107 Kafka-Streams-like declarative DSL.
Sourcepub async fn version(&self) -> Result<Value, PulseError>
pub async fn version(&self) -> Result<Value, PulseError>
GET /api/pulse/version — public, no JWT required. Returns the
Pulse server’s build + version metadata.
Trait Implementations§
Source§impl Clone for PulseClient
impl Clone for PulseClient
Source§fn clone(&self) -> PulseClient
fn clone(&self) -> PulseClient
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PulseClient
impl !RefUnwindSafe for PulseClient
impl Send for PulseClient
impl Sync for PulseClient
impl Unpin for PulseClient
impl UnsafeUnpin for PulseClient
impl !UnwindSafe for PulseClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more