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