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

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

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