Esempio n. 1
0
        /// <summary>
        /// Initializes any collection properties after deserialization, like next requests for paging.
        /// </summary>
        /// <param name="approvalWorkflowProviderToInitialize">The <see cref="ApprovalWorkflowProvider"/> with the collection properties to initialize.</param>
        private void InitializeCollectionProperties(ApprovalWorkflowProvider approvalWorkflowProviderToInitialize)
        {
            if (approvalWorkflowProviderToInitialize != null && approvalWorkflowProviderToInitialize.AdditionalData != null)
            {
                if (approvalWorkflowProviderToInitialize.BusinessFlows != null && approvalWorkflowProviderToInitialize.BusinessFlows.CurrentPage != null)
                {
                    approvalWorkflowProviderToInitialize.BusinessFlows.AdditionalData = approvalWorkflowProviderToInitialize.AdditionalData;

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

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        approvalWorkflowProviderToInitialize.BusinessFlows.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }

                if (approvalWorkflowProviderToInitialize.BusinessFlowsWithRequestsAwaitingMyDecision != null && approvalWorkflowProviderToInitialize.BusinessFlowsWithRequestsAwaitingMyDecision.CurrentPage != null)
                {
                    approvalWorkflowProviderToInitialize.BusinessFlowsWithRequestsAwaitingMyDecision.AdditionalData = approvalWorkflowProviderToInitialize.AdditionalData;

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

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        approvalWorkflowProviderToInitialize.BusinessFlowsWithRequestsAwaitingMyDecision.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }

                if (approvalWorkflowProviderToInitialize.PolicyTemplates != null && approvalWorkflowProviderToInitialize.PolicyTemplates.CurrentPage != null)
                {
                    approvalWorkflowProviderToInitialize.PolicyTemplates.AdditionalData = approvalWorkflowProviderToInitialize.AdditionalData;

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

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        approvalWorkflowProviderToInitialize.PolicyTemplates.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Creates the specified ApprovalWorkflowProvider using POST.
        /// </summary>
        /// <param name="approvalWorkflowProviderToCreate">The ApprovalWorkflowProvider to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created ApprovalWorkflowProvider.</returns>
        public async System.Threading.Tasks.Task <ApprovalWorkflowProvider> CreateAsync(ApprovalWorkflowProvider approvalWorkflowProviderToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <ApprovalWorkflowProvider>(approvalWorkflowProviderToCreate, cancellationToken).ConfigureAwait(false);

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

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
Esempio n. 5
0
 /// <summary>
 /// Adds the specified ApprovalWorkflowProvider to the collection via POST.
 /// </summary>
 /// <param name="approvalWorkflowProvider">The ApprovalWorkflowProvider to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created ApprovalWorkflowProvider.</returns>
 public System.Threading.Tasks.Task <ApprovalWorkflowProvider> AddAsync(ApprovalWorkflowProvider approvalWorkflowProvider, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <ApprovalWorkflowProvider>(approvalWorkflowProvider, cancellationToken));
 }
Esempio n. 6
0
 /// <summary>
 /// Adds the specified ApprovalWorkflowProvider to the collection via POST.
 /// </summary>
 /// <param name="approvalWorkflowProvider">The ApprovalWorkflowProvider to add.</param>
 /// <returns>The created ApprovalWorkflowProvider.</returns>
 public System.Threading.Tasks.Task <ApprovalWorkflowProvider> AddAsync(ApprovalWorkflowProvider approvalWorkflowProvider)
 {
     return(this.AddAsync(approvalWorkflowProvider, CancellationToken.None));
 }