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