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

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

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