/// <summary> /// Creates the specified DeviceComplianceDeviceOverview using POST. /// </summary> /// <param name="deviceComplianceDeviceOverviewToCreate">The DeviceComplianceDeviceOverview to create.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created DeviceComplianceDeviceOverview.</returns> public async System.Threading.Tasks.Task <DeviceComplianceDeviceOverview> CreateAsync(DeviceComplianceDeviceOverview deviceComplianceDeviceOverviewToCreate, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; var newEntity = await this.SendAsync <DeviceComplianceDeviceOverview>(deviceComplianceDeviceOverviewToCreate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(newEntity); return(newEntity); }
/// <summary> /// Initializes any collection properties after deserialization, like next requests for paging. /// </summary> /// <param name="deviceComplianceDeviceOverviewToInitialize">The <see cref="DeviceComplianceDeviceOverview"/> with the collection properties to initialize.</param> private void InitializeCollectionProperties(DeviceComplianceDeviceOverview deviceComplianceDeviceOverviewToInitialize) { }
/// <summary> /// Creates the specified DeviceComplianceDeviceOverview using POST. /// </summary> /// <param name="deviceComplianceDeviceOverviewToCreate">The DeviceComplianceDeviceOverview to create.</param> /// <returns>The created DeviceComplianceDeviceOverview.</returns> public System.Threading.Tasks.Task <DeviceComplianceDeviceOverview> CreateAsync(DeviceComplianceDeviceOverview deviceComplianceDeviceOverviewToCreate) { return(this.CreateAsync(deviceComplianceDeviceOverviewToCreate, CancellationToken.None)); }
/// <summary> /// Updates the specified DeviceComplianceDeviceOverview using PATCH. /// </summary> /// <param name="deviceComplianceDeviceOverviewToUpdate">The DeviceComplianceDeviceOverview 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 DeviceComplianceDeviceOverview.</returns> public async System.Threading.Tasks.Task <DeviceComplianceDeviceOverview> UpdateAsync(DeviceComplianceDeviceOverview deviceComplianceDeviceOverviewToUpdate, CancellationToken cancellationToken) { if (deviceComplianceDeviceOverviewToUpdate.AdditionalData != null) { if (deviceComplianceDeviceOverviewToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || deviceComplianceDeviceOverviewToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, deviceComplianceDeviceOverviewToUpdate.GetType().Name) }); } } if (deviceComplianceDeviceOverviewToUpdate.AdditionalData != null) { if (deviceComplianceDeviceOverviewToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || deviceComplianceDeviceOverviewToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, deviceComplianceDeviceOverviewToUpdate.GetType().Name) }); } } this.ContentType = "application/json"; this.Method = "PATCH"; var updatedEntity = await this.SendAsync <DeviceComplianceDeviceOverview>(deviceComplianceDeviceOverviewToUpdate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(updatedEntity); return(updatedEntity); }