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

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

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
Exemple #3
0
 /// <summary>
 /// Adds the specified PurchaseInvoiceLine to the collection via POST.
 /// </summary>
 /// <param name="purchaseInvoiceLine">The PurchaseInvoiceLine to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created PurchaseInvoiceLine.</returns>
 public System.Threading.Tasks.Task <PurchaseInvoiceLine> AddAsync(PurchaseInvoiceLine purchaseInvoiceLine, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <PurchaseInvoiceLine>(purchaseInvoiceLine, cancellationToken));
 }
Exemple #4
0
 /// <summary>
 /// Adds the specified PurchaseInvoiceLine to the collection via POST.
 /// </summary>
 /// <param name="purchaseInvoiceLine">The PurchaseInvoiceLine to add.</param>
 /// <returns>The created PurchaseInvoiceLine.</returns>
 public System.Threading.Tasks.Task <PurchaseInvoiceLine> AddAsync(PurchaseInvoiceLine purchaseInvoiceLine)
 {
     return(this.AddAsync(purchaseInvoiceLine, CancellationToken.None));
 }
Exemple #5
0
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="purchaseInvoiceLineToInitialize">The <see cref="PurchaseInvoiceLine"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(PurchaseInvoiceLine purchaseInvoiceLineToInitialize)
 {
 }