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