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

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
        /// <summary>
        /// Creates the specified B2cIdentityUserFlow using POST.
        /// </summary>
        /// <param name="b2cIdentityUserFlowToCreate">The B2cIdentityUserFlow to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created B2cIdentityUserFlow.</returns>
        public async System.Threading.Tasks.Task <B2cIdentityUserFlow> CreateAsync(B2cIdentityUserFlow b2cIdentityUserFlowToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <B2cIdentityUserFlow>(b2cIdentityUserFlowToCreate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
        /// <summary>
        /// Initializes any collection properties after deserialization, like next requests for paging.
        /// </summary>
        /// <param name="b2cIdentityUserFlowToInitialize">The <see cref="B2cIdentityUserFlow"/> with the collection properties to initialize.</param>
        private void InitializeCollectionProperties(B2cIdentityUserFlow b2cIdentityUserFlowToInitialize)
        {
            if (b2cIdentityUserFlowToInitialize != null && b2cIdentityUserFlowToInitialize.AdditionalData != null)
            {
                if (b2cIdentityUserFlowToInitialize.IdentityProviders != null && b2cIdentityUserFlowToInitialize.IdentityProviders.CurrentPage != null)
                {
                    b2cIdentityUserFlowToInitialize.IdentityProviders.AdditionalData = b2cIdentityUserFlowToInitialize.AdditionalData;

                    object nextPageLink;
                    b2cIdentityUserFlowToInitialize.AdditionalData.TryGetValue("*****@*****.**", out nextPageLink);
                    var nextPageLinkString = nextPageLink as string;

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        b2cIdentityUserFlowToInitialize.IdentityProviders.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }

                if (b2cIdentityUserFlowToInitialize.Languages != null && b2cIdentityUserFlowToInitialize.Languages.CurrentPage != null)
                {
                    b2cIdentityUserFlowToInitialize.Languages.AdditionalData = b2cIdentityUserFlowToInitialize.AdditionalData;

                    object nextPageLink;
                    b2cIdentityUserFlowToInitialize.AdditionalData.TryGetValue("*****@*****.**", out nextPageLink);
                    var nextPageLinkString = nextPageLink as string;

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        b2cIdentityUserFlowToInitialize.Languages.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }

                if (b2cIdentityUserFlowToInitialize.UserAttributeAssignments != null && b2cIdentityUserFlowToInitialize.UserAttributeAssignments.CurrentPage != null)
                {
                    b2cIdentityUserFlowToInitialize.UserAttributeAssignments.AdditionalData = b2cIdentityUserFlowToInitialize.AdditionalData;

                    object nextPageLink;
                    b2cIdentityUserFlowToInitialize.AdditionalData.TryGetValue("*****@*****.**", out nextPageLink);
                    var nextPageLinkString = nextPageLink as string;

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        b2cIdentityUserFlowToInitialize.UserAttributeAssignments.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }
            }
        }
Beispiel #4
0
 /// <summary>
 /// Adds the specified B2cIdentityUserFlow to the collection via POST.
 /// </summary>
 /// <param name="b2cIdentityUserFlow">The B2cIdentityUserFlow to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created B2cIdentityUserFlow.</returns>
 public System.Threading.Tasks.Task <B2cIdentityUserFlow> AddAsync(B2cIdentityUserFlow b2cIdentityUserFlow, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <B2cIdentityUserFlow>(b2cIdentityUserFlow, cancellationToken));
 }
Beispiel #5
0
 /// <summary>
 /// Adds the specified B2cIdentityUserFlow to the collection via POST.
 /// </summary>
 /// <param name="b2cIdentityUserFlow">The B2cIdentityUserFlow to add.</param>
 /// <returns>The created B2cIdentityUserFlow.</returns>
 public System.Threading.Tasks.Task <B2cIdentityUserFlow> AddAsync(B2cIdentityUserFlow b2cIdentityUserFlow)
 {
     return(this.AddAsync(b2cIdentityUserFlow, CancellationToken.None));
 }
 /// <summary>
 /// Creates the specified B2cIdentityUserFlow using POST.
 /// </summary>
 /// <param name="b2cIdentityUserFlowToCreate">The B2cIdentityUserFlow to create.</param>
 /// <returns>The created B2cIdentityUserFlow.</returns>
 public System.Threading.Tasks.Task <B2cIdentityUserFlow> CreateAsync(B2cIdentityUserFlow b2cIdentityUserFlowToCreate)
 {
     return(this.CreateAsync(b2cIdentityUserFlowToCreate, CancellationToken.None));
 }