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

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

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