pub struct DattoClient { /* private fields */ }Expand description
Datto RMM API client.
This client handles authentication and provides access to the generated API methods.
§Example
use datto_api::{DattoClient, Platform, Credentials};
#[tokio::main]
async fn main() -> Result<(), datto_api::Error> {
let client = DattoClient::new(
Platform::Merlot,
Credentials {
api_key: "your-api-key".into(),
api_secret: "your-api-secret".into(),
},
).await?;
// Use the client...
Ok(())
}Implementations§
Source§impl DattoClient
impl DattoClient
Sourcepub async fn new(
platform: Platform,
credentials: Credentials,
) -> Result<Self, Error>
pub async fn new( platform: Platform, credentials: Credentials, ) -> Result<Self, Error>
Create a new Datto RMM API client.
This will immediately fetch an access token.
Sourcepub async fn ensure_token(&self) -> Result<String, Error>
pub async fn ensure_token(&self) -> Result<String, Error>
Ensure we have a valid access token.
Returns the token if valid, refreshes if expired.
Sourcepub fn http_client(&self) -> &HttpClient
pub fn http_client(&self) -> &HttpClient
Get the HTTP client for making custom requests.
Note: You’ll need to add the Authorization header yourself.
Auto Trait Implementations§
impl Freeze for DattoClient
impl !RefUnwindSafe for DattoClient
impl Send for DattoClient
impl Sync for DattoClient
impl Unpin for DattoClient
impl !UnwindSafe for DattoClient
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