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

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

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        customerPaymentJournalToInitialize.CustomerPayments.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// Adds the specified CustomerPaymentJournal to the collection via POST.
 /// </summary>
 /// <param name="customerPaymentJournal">The CustomerPaymentJournal to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created CustomerPaymentJournal.</returns>
 public System.Threading.Tasks.Task <CustomerPaymentJournal> AddAsync(CustomerPaymentJournal customerPaymentJournal, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <CustomerPaymentJournal>(customerPaymentJournal, cancellationToken));
 }
Beispiel #3
0
 /// <summary>
 /// Adds the specified CustomerPaymentJournal to the collection via POST.
 /// </summary>
 /// <param name="customerPaymentJournal">The CustomerPaymentJournal to add.</param>
 /// <returns>The created CustomerPaymentJournal.</returns>
 public System.Threading.Tasks.Task <CustomerPaymentJournal> AddAsync(CustomerPaymentJournal customerPaymentJournal)
 {
     return(this.AddAsync(customerPaymentJournal, CancellationToken.None));
 }
Beispiel #4
0
        /// <summary>
        /// Creates the specified CustomerPaymentJournal using POST.
        /// </summary>
        /// <param name="customerPaymentJournalToCreate">The CustomerPaymentJournal to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created CustomerPaymentJournal.</returns>
        public async System.Threading.Tasks.Task <CustomerPaymentJournal> CreateAsync(CustomerPaymentJournal customerPaymentJournalToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <CustomerPaymentJournal>(customerPaymentJournalToCreate, cancellationToken).ConfigureAwait(false);

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

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