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

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

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
Example #3
0
        /// <summary>
        /// Updates the specified DirectoryRoleTemplate using PATCH.
        /// </summary>
        /// <param name="directoryRoleTemplateToUpdate">The DirectoryRoleTemplate to update.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The updated DirectoryRoleTemplate.</returns>
        public async Task <DirectoryRoleTemplate> UpdateAsync(DirectoryRoleTemplate directoryRoleTemplateToUpdate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <DirectoryRoleTemplate>(directoryRoleTemplateToUpdate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
 /// <summary>
 /// Creates the specified DirectoryRoleTemplate using POST.
 /// </summary>
 /// <param name="directoryRoleTemplateToCreate">The DirectoryRoleTemplate to create.</param>
 /// <returns>The created DirectoryRoleTemplate.</returns>
 public System.Threading.Tasks.Task <DirectoryRoleTemplate> CreateAsync(DirectoryRoleTemplate directoryRoleTemplateToCreate)
 {
     return(this.CreateAsync(directoryRoleTemplateToCreate, CancellationToken.None));
 }
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="directoryRoleTemplateToInitialize">The <see cref="DirectoryRoleTemplate"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(DirectoryRoleTemplate directoryRoleTemplateToInitialize)
 {
 }
Example #6
0
 /// <summary>
 /// Updates the specified DirectoryRoleTemplate using PATCH.
 /// </summary>
 /// <param name="directoryRoleTemplateToUpdate">The DirectoryRoleTemplate to update.</param>
 /// <returns>The updated DirectoryRoleTemplate.</returns>
 public Task <DirectoryRoleTemplate> UpdateAsync(DirectoryRoleTemplate directoryRoleTemplateToUpdate)
 {
     return(this.UpdateAsync(directoryRoleTemplateToUpdate, CancellationToken.None));
 }
 /// <summary>
 /// Adds the specified DirectoryRoleTemplate to the collection via POST.
 /// </summary>
 /// <param name="directoryRoleTemplate">The DirectoryRoleTemplate to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created DirectoryRoleTemplate.</returns>
 public Task <DirectoryRoleTemplate> AddAsync(DirectoryRoleTemplate directoryRoleTemplate, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <DirectoryRoleTemplate>(directoryRoleTemplate, cancellationToken));
 }