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

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

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