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