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

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

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