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

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

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

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

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

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

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

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

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

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

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