pub fn new(
        device_update_url: &str,
        token_credential: Arc<dyn TokenCredential>,
    ) -> azure_core::Result<Self> {
        let device_update_url = Url::parse(device_update_url)
            .with_context(ErrorKind::DataConversion, || {
                format!("failed to parse update url: {device_update_url}")
            })?;
        let endpoint = extract_endpoint(&device_update_url)?;
        let token_credential = AutoRefreshingTokenCredential::new(token_credential);

        let client = DeviceUpdateClient {
            device_update_url,
            endpoint,
            token_credential,
        };
        Ok(client)
    }
/// Creates a new `DeviceUpdateClient`.
///
/// # Example
///
/// ```no_run
/// use azure_device_update::DeviceUpdateClient;
/// use azure_identity::DefaultAzureCredential;
/// let creds = std::sync::Arc::new(DefaultAzureCredential::default());
/// let client = DeviceUpdateClient::new("contoso.api.adu.microsoft.com", creds).unwrap();
/// ```
Creates a new `DeviceUpdateClient`.
Creates a new ` DeviceUpdateClient ` .
pub fn new(
        device_update_url: &str,
        token_credential: Arc<dyn TokenCredential>,
    ) -> azure_core::Result<Self> {
        let device_update_url = Url::parse(device_update_url)
            .with_context(ErrorKind::DataConversion, || {
                format!("failed to parse update url: {device_update_url}")
            })?;
        let endpoint = extract_endpoint(&device_update_url)?;
        let token_credential = AutoRefreshingTokenCredential::new(token_credential);
        let client = DeviceUpdateClient {
            device_update_url,
            endpoint,
            token_credential,
        };
        Ok(client)
    }
pub fn new ( device_update_url : & str , token_credential : Arc < dyn TokenCredential > , ) -> azure_core :: Result < Self > { let device_update_url = Url :: parse ( device_update_url ) . with_context ( ErrorKind :: DataConversion , | | { format ! ( " " ) } ) ? ; let endpoint = extract_endpoint ( & device_update_url ) ? ; let token_credential = AutoRefreshingTokenCredential :: new ( token_credential ) ; let client = DeviceUpdateClient { device_update_url , endpoint , token_credential , } ; Ok ( client ) }
Creates a new `DeviceUpdateClient`.
Creates a new ` DeviceUpdateClient ` .
device_update_url
&str
token_credential
Arc<dyn TokenCredential>
example
```no_run
use azure_device_update::DeviceUpdateClient;
use azure_identity::DefaultAzureCredential;
let creds = std::sync::Arc::new(DefaultAzureCredential::default());
let client = DeviceUpdateClient::new("contoso.api.adu.microsoft.com", creds).unwrap();
```
` ` ` no_run use azure_device_update :: DeviceUpdateClient ; use azure_identity :: DefaultAzureCredential ; let creds = std :: sync :: Arc :: new ( DefaultAzureCredential :: default () ) ; let client = DeviceUpdateClient :: new ( " contoso . api . adu . microsoft . com " creds ) . unwrap () ; ` ` `