/// <summary>
 /// Adds the specified SingleValueLegacyExtendedProperty to the collection via POST.
 /// </summary>
 /// <param name="singleValueLegacyExtendedProperty">The SingleValueLegacyExtendedProperty to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created SingleValueLegacyExtendedProperty.</returns>
 public System.Threading.Tasks.Task <SingleValueLegacyExtendedProperty> AddAsync(SingleValueLegacyExtendedProperty singleValueLegacyExtendedProperty, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <SingleValueLegacyExtendedProperty>(singleValueLegacyExtendedProperty, cancellationToken));
 }
 /// <summary>
 /// Adds the specified SingleValueLegacyExtendedProperty to the collection via POST.
 /// </summary>
 /// <param name="singleValueLegacyExtendedProperty">The SingleValueLegacyExtendedProperty to add.</param>
 /// <returns>The created SingleValueLegacyExtendedProperty.</returns>
 public System.Threading.Tasks.Task <SingleValueLegacyExtendedProperty> AddAsync(SingleValueLegacyExtendedProperty singleValueLegacyExtendedProperty)
 {
     return(this.AddAsync(singleValueLegacyExtendedProperty, CancellationToken.None));
 }
        /// <summary>
        /// Creates the specified SingleValueLegacyExtendedProperty using POST.
        /// </summary>
        /// <param name="singleValueLegacyExtendedPropertyToCreate">The SingleValueLegacyExtendedProperty to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created SingleValueLegacyExtendedProperty.</returns>
        public async System.Threading.Tasks.Task <SingleValueLegacyExtendedProperty> CreateAsync(SingleValueLegacyExtendedProperty singleValueLegacyExtendedPropertyToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <SingleValueLegacyExtendedProperty>(singleValueLegacyExtendedPropertyToCreate, cancellationToken).ConfigureAwait(false);

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

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