pub struct AdminClient { /* private fields */ }Expand description
Admin API client for managing mocks
Implementations§
Source§impl AdminClient
impl AdminClient
Sourcepub fn new(base_url: impl Into<String>) -> Self
pub fn new(base_url: impl Into<String>) -> Self
Create a new admin client
The base URL should be the root URL of the MockForge server (e.g., “http://localhost:3000”). Trailing slashes are automatically removed.
§Examples
use mockforge_sdk::AdminClient;
let client = AdminClient::new("http://localhost:3000");
// Also works with trailing slash:
let client = AdminClient::new("http://localhost:3000/");Sourcepub async fn list_mocks(&self) -> Result<MockList>
pub async fn list_mocks(&self) -> Result<MockList>
List all mocks
Sourcepub async fn get_mock(&self, id: &str) -> Result<MockConfig>
pub async fn get_mock(&self, id: &str) -> Result<MockConfig>
Get a specific mock by ID
Sourcepub async fn create_mock(&self, mock: MockConfig) -> Result<MockConfig>
pub async fn create_mock(&self, mock: MockConfig) -> Result<MockConfig>
Create a new mock
Sourcepub async fn update_mock(
&self,
id: &str,
mock: MockConfig,
) -> Result<MockConfig>
pub async fn update_mock( &self, id: &str, mock: MockConfig, ) -> Result<MockConfig>
Update an existing mock
Sourcepub async fn delete_mock(&self, id: &str) -> Result<()>
pub async fn delete_mock(&self, id: &str) -> Result<()>
Delete a mock
Sourcepub async fn get_stats(&self) -> Result<ServerStats>
pub async fn get_stats(&self) -> Result<ServerStats>
Get server statistics
Sourcepub async fn get_config(&self) -> Result<ServerConfig>
pub async fn get_config(&self) -> Result<ServerConfig>
Get server configuration
Auto Trait Implementations§
impl Freeze for AdminClient
impl !RefUnwindSafe for AdminClient
impl Send for AdminClient
impl Sync for AdminClient
impl Unpin for AdminClient
impl !UnwindSafe for AdminClient
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