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

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

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