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