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

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

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