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