pub struct BackstageClient { /* private fields */ }
Expand description
A client for interacting with the Backstage API.
Implementations§
Source§impl BackstageClient
impl BackstageClient
Sourcepub async fn fetch_entities<T: DeserializeOwned>(
&self,
filters: Option<HashMap<String, String>>,
) -> Result<Vec<T>>
pub async fn fetch_entities<T: DeserializeOwned>( &self, filters: Option<HashMap<String, String>>, ) -> Result<Vec<T>>
Fetches entities from the Backstage API based on filters.
§Arguments
filters
- Optional filters to apply to the request.
§Returns
A Result
containing a vector of entities or a ClientError
.
§Examples
use backstage_client::{BackstageClient, entities::Entity};
use std::collections::HashMap;
let client = BackstageClient::new("https://backstage.example.com", "token")?;
// Fetch all entities
let entities = client.fetch_entities::<Entity>(None).await?;
// Fetch only components
let mut filters = HashMap::new();
filters.insert("kind".to_string(), "Component".to_string());
let components = client.fetch_entities::<Entity>(Some(filters)).await?;
Sourcepub async fn get_entity<T: DeserializeOwned>(
&self,
kind: &str,
namespace: Option<&str>,
name: &str,
) -> Result<T>
pub async fn get_entity<T: DeserializeOwned>( &self, kind: &str, namespace: Option<&str>, name: &str, ) -> Result<T>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BackstageClient
impl !RefUnwindSafe for BackstageClient
impl Send for BackstageClient
impl Sync for BackstageClient
impl Unpin for BackstageClient
impl !UnwindSafe for BackstageClient
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