Exemple #1
0
 /// <summary>
 /// Adds the specified UserExperienceAnalyticsAppHealthDevicePerformanceDetails to the collection via POST.
 /// </summary>
 /// <param name="userExperienceAnalyticsAppHealthDevicePerformanceDetails">The UserExperienceAnalyticsAppHealthDevicePerformanceDetails to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created UserExperienceAnalyticsAppHealthDevicePerformanceDetails.</returns>
 public System.Threading.Tasks.Task <UserExperienceAnalyticsAppHealthDevicePerformanceDetails> AddAsync(UserExperienceAnalyticsAppHealthDevicePerformanceDetails userExperienceAnalyticsAppHealthDevicePerformanceDetails, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <UserExperienceAnalyticsAppHealthDevicePerformanceDetails>(userExperienceAnalyticsAppHealthDevicePerformanceDetails, cancellationToken));
 }
Exemple #2
0
 /// <summary>
 /// Adds the specified UserExperienceAnalyticsAppHealthDevicePerformanceDetails to the collection via POST.
 /// </summary>
 /// <param name="userExperienceAnalyticsAppHealthDevicePerformanceDetails">The UserExperienceAnalyticsAppHealthDevicePerformanceDetails to add.</param>
 /// <returns>The created UserExperienceAnalyticsAppHealthDevicePerformanceDetails.</returns>
 public System.Threading.Tasks.Task <UserExperienceAnalyticsAppHealthDevicePerformanceDetails> AddAsync(UserExperienceAnalyticsAppHealthDevicePerformanceDetails userExperienceAnalyticsAppHealthDevicePerformanceDetails)
 {
     return(this.AddAsync(userExperienceAnalyticsAppHealthDevicePerformanceDetails, CancellationToken.None));
 }
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="userExperienceAnalyticsAppHealthDevicePerformanceDetailsToInitialize">The <see cref="UserExperienceAnalyticsAppHealthDevicePerformanceDetails"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(UserExperienceAnalyticsAppHealthDevicePerformanceDetails userExperienceAnalyticsAppHealthDevicePerformanceDetailsToInitialize)
 {
 }
        /// <summary>
        /// Creates the specified UserExperienceAnalyticsAppHealthDevicePerformanceDetails using POST.
        /// </summary>
        /// <param name="userExperienceAnalyticsAppHealthDevicePerformanceDetailsToCreate">The UserExperienceAnalyticsAppHealthDevicePerformanceDetails to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created UserExperienceAnalyticsAppHealthDevicePerformanceDetails.</returns>
        public async System.Threading.Tasks.Task <UserExperienceAnalyticsAppHealthDevicePerformanceDetails> CreateAsync(UserExperienceAnalyticsAppHealthDevicePerformanceDetails userExperienceAnalyticsAppHealthDevicePerformanceDetailsToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <UserExperienceAnalyticsAppHealthDevicePerformanceDetails>(userExperienceAnalyticsAppHealthDevicePerformanceDetailsToCreate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
        /// <summary>
        /// Updates the specified UserExperienceAnalyticsAppHealthDevicePerformanceDetails using PATCH.
        /// </summary>
        /// <param name="userExperienceAnalyticsAppHealthDevicePerformanceDetailsToUpdate">The UserExperienceAnalyticsAppHealthDevicePerformanceDetails 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 UserExperienceAnalyticsAppHealthDevicePerformanceDetails.</returns>
        public async System.Threading.Tasks.Task <UserExperienceAnalyticsAppHealthDevicePerformanceDetails> UpdateAsync(UserExperienceAnalyticsAppHealthDevicePerformanceDetails userExperienceAnalyticsAppHealthDevicePerformanceDetailsToUpdate, CancellationToken cancellationToken)
        {
            if (userExperienceAnalyticsAppHealthDevicePerformanceDetailsToUpdate.AdditionalData != null)
            {
                if (userExperienceAnalyticsAppHealthDevicePerformanceDetailsToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    userExperienceAnalyticsAppHealthDevicePerformanceDetailsToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, userExperienceAnalyticsAppHealthDevicePerformanceDetailsToUpdate.GetType().Name)
                    });
                }
            }
            if (userExperienceAnalyticsAppHealthDevicePerformanceDetailsToUpdate.AdditionalData != null)
            {
                if (userExperienceAnalyticsAppHealthDevicePerformanceDetailsToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    userExperienceAnalyticsAppHealthDevicePerformanceDetailsToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, userExperienceAnalyticsAppHealthDevicePerformanceDetailsToUpdate.GetType().Name)
                    });
                }
            }
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <UserExperienceAnalyticsAppHealthDevicePerformanceDetails>(userExperienceAnalyticsAppHealthDevicePerformanceDetailsToUpdate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }