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

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

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