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

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

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