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