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

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

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
 /// <summary>
 /// Creates the specified ChatThread using POST.
 /// </summary>
 /// <param name="chatThreadToCreate">The ChatThread to create.</param>
 /// <returns>The created ChatThread.</returns>
 public System.Threading.Tasks.Task <ChatThread> CreateAsync(ChatThread chatThreadToCreate)
 {
     return(this.CreateAsync(chatThreadToCreate, CancellationToken.None));
 }
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="chatThreadToInitialize">The <see cref="ChatThread"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(ChatThread chatThreadToInitialize)
 {
 }
Пример #5
0
 /// <summary>
 /// Adds the specified ChatThread to the collection via POST.
 /// </summary>
 /// <param name="chatThread">The ChatThread to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created ChatThread.</returns>
 public System.Threading.Tasks.Task <ChatThread> AddAsync(ChatThread chatThread, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <ChatThread>(chatThread, cancellationToken));
 }
Пример #6
0
 /// <summary>
 /// Adds the specified ChatThread to the collection via POST.
 /// </summary>
 /// <param name="chatThread">The ChatThread to add.</param>
 /// <returns>The created ChatThread.</returns>
 public System.Threading.Tasks.Task <ChatThread> AddAsync(ChatThread chatThread)
 {
     return(this.AddAsync(chatThread, CancellationToken.None));
 }