/// <summary> /// Creates the specified WindowsManagementAppHealthSummary using POST. /// </summary> /// <param name="windowsManagementAppHealthSummaryToCreate">The WindowsManagementAppHealthSummary to create.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created WindowsManagementAppHealthSummary.</returns> public async System.Threading.Tasks.Task <WindowsManagementAppHealthSummary> CreateAsync(WindowsManagementAppHealthSummary windowsManagementAppHealthSummaryToCreate, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; var newEntity = await this.SendAsync <WindowsManagementAppHealthSummary>(windowsManagementAppHealthSummaryToCreate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(newEntity); return(newEntity); }
/// <summary> /// Initializes any collection properties after deserialization, like next requests for paging. /// </summary> /// <param name="windowsManagementAppHealthSummaryToInitialize">The <see cref="WindowsManagementAppHealthSummary"/> with the collection properties to initialize.</param> private void InitializeCollectionProperties(WindowsManagementAppHealthSummary windowsManagementAppHealthSummaryToInitialize) { }
/// <summary> /// Creates the specified WindowsManagementAppHealthSummary using POST. /// </summary> /// <param name="windowsManagementAppHealthSummaryToCreate">The WindowsManagementAppHealthSummary to create.</param> /// <returns>The created WindowsManagementAppHealthSummary.</returns> public System.Threading.Tasks.Task <WindowsManagementAppHealthSummary> CreateAsync(WindowsManagementAppHealthSummary windowsManagementAppHealthSummaryToCreate) { return(this.CreateAsync(windowsManagementAppHealthSummaryToCreate, CancellationToken.None)); }
/// <summary> /// Updates the specified WindowsManagementAppHealthSummary using PATCH. /// </summary> /// <param name="windowsManagementAppHealthSummaryToUpdate">The WindowsManagementAppHealthSummary to update.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <exception cref="ClientException">Thrown when an object returned in a response is used for updating an object in Microsoft Graph.</exception> /// <returns>The updated WindowsManagementAppHealthSummary.</returns> public async System.Threading.Tasks.Task <WindowsManagementAppHealthSummary> UpdateAsync(WindowsManagementAppHealthSummary windowsManagementAppHealthSummaryToUpdate, CancellationToken cancellationToken) { if (windowsManagementAppHealthSummaryToUpdate.AdditionalData != null) { if (windowsManagementAppHealthSummaryToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || windowsManagementAppHealthSummaryToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, windowsManagementAppHealthSummaryToUpdate.GetType().Name) }); } } if (windowsManagementAppHealthSummaryToUpdate.AdditionalData != null) { if (windowsManagementAppHealthSummaryToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || windowsManagementAppHealthSummaryToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, windowsManagementAppHealthSummaryToUpdate.GetType().Name) }); } } this.ContentType = "application/json"; this.Method = "PATCH"; var updatedEntity = await this.SendAsync <WindowsManagementAppHealthSummary>(windowsManagementAppHealthSummaryToUpdate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(updatedEntity); return(updatedEntity); }