/// <summary> /// Updates the specified SalesOrderLine using PATCH. /// </summary> /// <param name="salesOrderLineToUpdate">The SalesOrderLine 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 SalesOrderLine.</returns> public async System.Threading.Tasks.Task <SalesOrderLine> UpdateAsync(SalesOrderLine salesOrderLineToUpdate, CancellationToken cancellationToken) { if (salesOrderLineToUpdate.AdditionalData != null) { if (salesOrderLineToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || salesOrderLineToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, salesOrderLineToUpdate.GetType().Name) }); } } if (salesOrderLineToUpdate.AdditionalData != null) { if (salesOrderLineToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || salesOrderLineToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, salesOrderLineToUpdate.GetType().Name) }); } } this.ContentType = "application/json"; this.Method = "PATCH"; var updatedEntity = await this.SendAsync <SalesOrderLine>(salesOrderLineToUpdate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(updatedEntity); return(updatedEntity); }
/// <summary> /// Creates the specified SalesOrderLine using POST. /// </summary> /// <param name="salesOrderLineToCreate">The SalesOrderLine to create.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created SalesOrderLine.</returns> public async System.Threading.Tasks.Task <SalesOrderLine> CreateAsync(SalesOrderLine salesOrderLineToCreate, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; var newEntity = await this.SendAsync <SalesOrderLine>(salesOrderLineToCreate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(newEntity); return(newEntity); }
/// <summary> /// Adds the specified SalesOrderLine to the collection via POST. /// </summary> /// <param name="salesOrderLine">The SalesOrderLine to add.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created SalesOrderLine.</returns> public System.Threading.Tasks.Task <SalesOrderLine> AddAsync(SalesOrderLine salesOrderLine, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; return(this.SendAsync <SalesOrderLine>(salesOrderLine, cancellationToken)); }
/// <summary> /// Adds the specified SalesOrderLine to the collection via POST. /// </summary> /// <param name="salesOrderLine">The SalesOrderLine to add.</param> /// <returns>The created SalesOrderLine.</returns> public System.Threading.Tasks.Task <SalesOrderLine> AddAsync(SalesOrderLine salesOrderLine) { return(this.AddAsync(salesOrderLine, CancellationToken.None)); }
/// <summary> /// Initializes any collection properties after deserialization, like next requests for paging. /// </summary> /// <param name="salesOrderLineToInitialize">The <see cref="SalesOrderLine"/> with the collection properties to initialize.</param> private void InitializeCollectionProperties(SalesOrderLine salesOrderLineToInitialize) { }
/// <summary> /// Updates the specified SalesOrderLine using PATCH. /// </summary> /// <param name="salesOrderLineToUpdate">The SalesOrderLine to update.</param> /// <returns>The updated SalesOrderLine.</returns> public System.Threading.Tasks.Task <SalesOrderLine> UpdateAsync(SalesOrderLine salesOrderLineToUpdate) { return(this.UpdateAsync(salesOrderLineToUpdate, CancellationToken.None)); }