示例#1
0
        /// <summary>
        /// Creates the specified UserExperienceAnalyticsMetric using POST.
        /// </summary>
        /// <param name="userExperienceAnalyticsMetricToCreate">The UserExperienceAnalyticsMetric to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created UserExperienceAnalyticsMetric.</returns>
        public async System.Threading.Tasks.Task <UserExperienceAnalyticsMetric> CreateAsync(UserExperienceAnalyticsMetric userExperienceAnalyticsMetricToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <UserExperienceAnalyticsMetric>(userExperienceAnalyticsMetricToCreate, cancellationToken).ConfigureAwait(false);

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

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
 /// <summary>
 /// Adds the specified UserExperienceAnalyticsMetric to the collection via POST.
 /// </summary>
 /// <param name="userExperienceAnalyticsMetric">The UserExperienceAnalyticsMetric to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created UserExperienceAnalyticsMetric.</returns>
 public System.Threading.Tasks.Task <UserExperienceAnalyticsMetric> AddAsync(UserExperienceAnalyticsMetric userExperienceAnalyticsMetric, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <UserExperienceAnalyticsMetric>(userExperienceAnalyticsMetric, cancellationToken));
 }
 /// <summary>
 /// Adds the specified UserExperienceAnalyticsMetric to the collection via POST.
 /// </summary>
 /// <param name="userExperienceAnalyticsMetric">The UserExperienceAnalyticsMetric to add.</param>
 /// <returns>The created UserExperienceAnalyticsMetric.</returns>
 public System.Threading.Tasks.Task <UserExperienceAnalyticsMetric> AddAsync(UserExperienceAnalyticsMetric userExperienceAnalyticsMetric)
 {
     return(this.AddAsync(userExperienceAnalyticsMetric, CancellationToken.None));
 }