/// <summary> /// Initializes any collection properties after deserialization, like next requests for paging. /// </summary> /// <param name="deviceComplianceScheduledActionForRuleToInitialize">The <see cref="DeviceComplianceScheduledActionForRule"/> with the collection properties to initialize.</param> private void InitializeCollectionProperties(DeviceComplianceScheduledActionForRule deviceComplianceScheduledActionForRuleToInitialize) { if (deviceComplianceScheduledActionForRuleToInitialize != null && deviceComplianceScheduledActionForRuleToInitialize.AdditionalData != null) { if (deviceComplianceScheduledActionForRuleToInitialize.ScheduledActionConfigurations != null && deviceComplianceScheduledActionForRuleToInitialize.ScheduledActionConfigurations.CurrentPage != null) { deviceComplianceScheduledActionForRuleToInitialize.ScheduledActionConfigurations.AdditionalData = deviceComplianceScheduledActionForRuleToInitialize.AdditionalData; object nextPageLink; deviceComplianceScheduledActionForRuleToInitialize.AdditionalData.TryGetValue("*****@*****.**", out nextPageLink); var nextPageLinkString = nextPageLink as string; if (!string.IsNullOrEmpty(nextPageLinkString)) { deviceComplianceScheduledActionForRuleToInitialize.ScheduledActionConfigurations.InitializeNextPageRequest( this.Client, nextPageLinkString); } } } }
/// <summary> /// Adds the specified DeviceComplianceScheduledActionForRule to the collection via POST. /// </summary> /// <param name="deviceComplianceScheduledActionForRule">The DeviceComplianceScheduledActionForRule to add.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created DeviceComplianceScheduledActionForRule.</returns> public System.Threading.Tasks.Task <DeviceComplianceScheduledActionForRule> AddAsync(DeviceComplianceScheduledActionForRule deviceComplianceScheduledActionForRule, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; return(this.SendAsync <DeviceComplianceScheduledActionForRule>(deviceComplianceScheduledActionForRule, cancellationToken)); }
/// <summary> /// Adds the specified DeviceComplianceScheduledActionForRule to the collection via POST. /// </summary> /// <param name="deviceComplianceScheduledActionForRule">The DeviceComplianceScheduledActionForRule to add.</param> /// <returns>The created DeviceComplianceScheduledActionForRule.</returns> public System.Threading.Tasks.Task <DeviceComplianceScheduledActionForRule> AddAsync(DeviceComplianceScheduledActionForRule deviceComplianceScheduledActionForRule) { return(this.AddAsync(deviceComplianceScheduledActionForRule, CancellationToken.None)); }
/// <summary> /// Creates the specified DeviceComplianceScheduledActionForRule using POST. /// </summary> /// <param name="deviceComplianceScheduledActionForRuleToCreate">The DeviceComplianceScheduledActionForRule to create.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created DeviceComplianceScheduledActionForRule.</returns> public async System.Threading.Tasks.Task <DeviceComplianceScheduledActionForRule> CreateAsync(DeviceComplianceScheduledActionForRule deviceComplianceScheduledActionForRuleToCreate, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; var newEntity = await this.SendAsync <DeviceComplianceScheduledActionForRule>(deviceComplianceScheduledActionForRuleToCreate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(newEntity); return(newEntity); }
/// <summary> /// Updates the specified DeviceComplianceScheduledActionForRule using PATCH. /// </summary> /// <param name="deviceComplianceScheduledActionForRuleToUpdate">The DeviceComplianceScheduledActionForRule 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 DeviceComplianceScheduledActionForRule.</returns> public async System.Threading.Tasks.Task <DeviceComplianceScheduledActionForRule> UpdateAsync(DeviceComplianceScheduledActionForRule deviceComplianceScheduledActionForRuleToUpdate, CancellationToken cancellationToken) { if (deviceComplianceScheduledActionForRuleToUpdate.AdditionalData != null) { if (deviceComplianceScheduledActionForRuleToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || deviceComplianceScheduledActionForRuleToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, deviceComplianceScheduledActionForRuleToUpdate.GetType().Name) }); } } if (deviceComplianceScheduledActionForRuleToUpdate.AdditionalData != null) { if (deviceComplianceScheduledActionForRuleToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || deviceComplianceScheduledActionForRuleToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, deviceComplianceScheduledActionForRuleToUpdate.GetType().Name) }); } } this.ContentType = "application/json"; this.Method = "PATCH"; var updatedEntity = await this.SendAsync <DeviceComplianceScheduledActionForRule>(deviceComplianceScheduledActionForRuleToUpdate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(updatedEntity); return(updatedEntity); }