예제 #1
0
        /// <summary>
        /// Create override.
        /// </summary>
        public void Save()
        {
            this.PreValidateSave();
            InferenceClassificationOverride inferenceClassificationOverride = this.Service.CreateInferenceClassificationOverride(this);

            this.propertyBag = inferenceClassificationOverride.propertyBag;
        }
 /// <summary>
 /// Adds the specified InferenceClassificationOverride to the collection via POST.
 /// </summary>
 /// <param name="inferenceClassificationOverride">The InferenceClassificationOverride to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created InferenceClassificationOverride.</returns>
 public System.Threading.Tasks.Task <InferenceClassificationOverride> AddAsync(InferenceClassificationOverride inferenceClassificationOverride, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <InferenceClassificationOverride>(inferenceClassificationOverride, cancellationToken));
 }
 /// <summary>
 /// Adds the specified InferenceClassificationOverride to the collection via POST.
 /// </summary>
 /// <param name="inferenceClassificationOverride">The InferenceClassificationOverride to add.</param>
 /// <returns>The created InferenceClassificationOverride.</returns>
 public System.Threading.Tasks.Task <InferenceClassificationOverride> AddAsync(InferenceClassificationOverride inferenceClassificationOverride)
 {
     return(this.AddAsync(inferenceClassificationOverride, CancellationToken.None));
 }
        /// <summary>
        /// Creates the specified InferenceClassificationOverride using POST.
        /// </summary>
        /// <param name="inferenceClassificationOverrideToCreate">The InferenceClassificationOverride to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created InferenceClassificationOverride.</returns>
        public async System.Threading.Tasks.Task <InferenceClassificationOverride> CreateAsync(InferenceClassificationOverride inferenceClassificationOverrideToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <InferenceClassificationOverride>(inferenceClassificationOverrideToCreate, cancellationToken).ConfigureAwait(false);

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

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }