/// <summary> /// Updates default type Id on Time Series model settings synchronously. /// </summary> /// <param name="defaultTypeId">Default type Id of the model that new instances will automatically belong to.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>The updated model settings with the http response <see cref="Response{TimeSeriesModelSettings}"/>.</returns> /// <seealso cref="UpdateDefaultTypeIdAsync(string, CancellationToken)"> /// See the asynchronous version of this method for examples. /// </seealso> public virtual Response <TimeSeriesModelSettings> UpdateDefaultTypeId(string defaultTypeId, CancellationToken cancellationToken = default) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(TimeSeriesInsightsClient)}.{nameof(UpdateDefaultTypeId)}"); scope.Start(); try { var options = new UpdateModelSettingsRequest { DefaultTypeId = defaultTypeId }; Response <ModelSettingsResponse> modelSettings = _modelSettingsRestClient.Update(options, null, cancellationToken); return(Response.FromValue(modelSettings.Value.ModelSettings, modelSettings.GetRawResponse())); } catch (Exception ex) { scope.Failed(ex); throw; } }
/// <summary> /// Updates model name on Time Series model settings asynchronously. /// </summary> /// <param name="name">Model display name which is mutable by the user. Initial value is "DefaultModel".</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>The updated model settings with the http response <see cref="Response{TimeSeriesModelSettings}"/>.</returns> /// <example> /// <code snippet="Snippet:TimeSeriesInsightsSampleUpdateModelSettingsName"> /// Response<TimeSeriesModelSettings> updateModelSettingsNameResponse = await client.ModelSettings.UpdateNameAsync("NewModelSettingsName"); /// Console.WriteLine($"Updated Time Series Insights model settings name: " + /// $"{updateModelSettingsNameResponse.Value.Name}"); /// </code> /// </example> public virtual async Task <Response <TimeSeriesModelSettings> > UpdateNameAsync(string name, CancellationToken cancellationToken = default) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(TimeSeriesInsightsClient)}.{nameof(UpdateName)}"); scope.Start(); try { var options = new UpdateModelSettingsRequest { Name = name }; Response <ModelSettingsResponse> modelSettings = await _modelSettingsRestClient.UpdateAsync(options, null, cancellationToken).ConfigureAwait(false); return(Response.FromValue(modelSettings.Value.ModelSettings, modelSettings.GetRawResponse())); } catch (Exception ex) { scope.Failed(ex); throw; } }