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

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

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