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