示例#1
0
        /// <summary>
        /// Initializes any collection properties after deserialization, like next requests for paging.
        /// </summary>
        /// <param name="userExperienceAnalyticsCategoryToInitialize">The <see cref="UserExperienceAnalyticsCategory"/> with the collection properties to initialize.</param>
        private void InitializeCollectionProperties(UserExperienceAnalyticsCategory userExperienceAnalyticsCategoryToInitialize)
        {
            if (userExperienceAnalyticsCategoryToInitialize != null && userExperienceAnalyticsCategoryToInitialize.AdditionalData != null)
            {
                if (userExperienceAnalyticsCategoryToInitialize.MetricValues != null && userExperienceAnalyticsCategoryToInitialize.MetricValues.CurrentPage != null)
                {
                    userExperienceAnalyticsCategoryToInitialize.MetricValues.AdditionalData = userExperienceAnalyticsCategoryToInitialize.AdditionalData;

                    object nextPageLink;
                    userExperienceAnalyticsCategoryToInitialize.AdditionalData.TryGetValue("*****@*****.**", out nextPageLink);
                    var nextPageLinkString = nextPageLink as string;

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        userExperienceAnalyticsCategoryToInitialize.MetricValues.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }
            }
        }
 /// <summary>
 /// Adds the specified UserExperienceAnalyticsCategory to the collection via POST.
 /// </summary>
 /// <param name="userExperienceAnalyticsCategory">The UserExperienceAnalyticsCategory to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created UserExperienceAnalyticsCategory.</returns>
 public System.Threading.Tasks.Task <UserExperienceAnalyticsCategory> AddAsync(UserExperienceAnalyticsCategory userExperienceAnalyticsCategory, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <UserExperienceAnalyticsCategory>(userExperienceAnalyticsCategory, cancellationToken));
 }
 /// <summary>
 /// Adds the specified UserExperienceAnalyticsCategory to the collection via POST.
 /// </summary>
 /// <param name="userExperienceAnalyticsCategory">The UserExperienceAnalyticsCategory to add.</param>
 /// <returns>The created UserExperienceAnalyticsCategory.</returns>
 public System.Threading.Tasks.Task <UserExperienceAnalyticsCategory> AddAsync(UserExperienceAnalyticsCategory userExperienceAnalyticsCategory)
 {
     return(this.AddAsync(userExperienceAnalyticsCategory, CancellationToken.None));
 }
示例#4
0
        /// <summary>
        /// Creates the specified UserExperienceAnalyticsCategory using POST.
        /// </summary>
        /// <param name="userExperienceAnalyticsCategoryToCreate">The UserExperienceAnalyticsCategory to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created UserExperienceAnalyticsCategory.</returns>
        public async System.Threading.Tasks.Task <UserExperienceAnalyticsCategory> CreateAsync(UserExperienceAnalyticsCategory userExperienceAnalyticsCategoryToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <UserExperienceAnalyticsCategory>(userExperienceAnalyticsCategoryToCreate, cancellationToken).ConfigureAwait(false);

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

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
示例#6
0
 /// <summary>
 /// Updates the specified UserExperienceAnalyticsCategory using PATCH.
 /// </summary>
 /// <param name="userExperienceAnalyticsCategoryToUpdate">The UserExperienceAnalyticsCategory to update.</param>
 /// <returns>The updated UserExperienceAnalyticsCategory.</returns>
 public System.Threading.Tasks.Task <UserExperienceAnalyticsCategory> UpdateAsync(UserExperienceAnalyticsCategory userExperienceAnalyticsCategoryToUpdate)
 {
     return(this.UpdateAsync(userExperienceAnalyticsCategoryToUpdate, CancellationToken.None));
 }