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

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

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