/// <summary>
        /// Gets Time Series model settings asynchronously.
        /// </summary>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>The model settings which includes model display name, Time Series Id properties and default type Id with the http response <see cref="Response{TimeSeriesModelSettings}"/>.</returns>
        public virtual async Task <Response <TimeSeriesModelSettings> > GetModelSettingsAsync(CancellationToken cancellationToken = default)
        {
            using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(TimeSeriesInsightsClient)}.{nameof(GetModelSettings)}");
            scope.Start();
            try
            {
                // To do: Generate client session Id
                Response <ModelSettingsResponse> modelSettings = await _modelSettingsRestClient.GetAsync(null, cancellationToken).ConfigureAwait(false);

                return(Response.FromValue(modelSettings.Value.ModelSettings, modelSettings.GetRawResponse()));
            }
            catch (Exception ex)
            {
                scope.Failed(ex);
                throw;
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Returns the model settings which includes model display name, Time Series ID properties and default type ID. Every Gen2 environment has a model that is automatically created.
 /// </summary>
 /// <param name="clientSessionId"> Optional client session ID. Service records this value. Allows the service to trace a group of related operations across services, and allows the customer to contact support regarding a particular group of requests. </param>
 /// <param name="cancellationToken"> The cancellation token to use. </param>
 /// <returns>The deserialized application/json model settings digital twin and the http response <see cref="Response{ModelSettingsResponse}"/>.</returns>
 /// <example>
 /// This sample demonstrates getting and deserializing a model settings.
 ///
 /// <code snippet="Snippet:TimeSeriesInsightsGetModelSettings">
 /// // Get the model settings for the time series insights environment
 /// Response&lt;Models.ModelSettingsResponse&gt; response = await client.GetAsync().ConfigureAwait(false);
 /// Console.WriteLine($&quot;Retrieved model {response.Value.ModelSettings.Name}.&quot;);
 /// </code>
 /// </example>
 public virtual Task <Response <ModelSettingsResponse> > GetAsync(string clientSessionId = null, CancellationToken cancellationToken = default)
 {
     return(_modelSettingsRestClient.GetAsync(clientSessionId, cancellationToken));
 }