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