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

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

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
 /// <summary>
 /// Adds the specified GroupSettingTemplate to the collection via POST.
 /// </summary>
 /// <param name="groupSettingTemplate">The GroupSettingTemplate to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created GroupSettingTemplate.</returns>
 public System.Threading.Tasks.Task <GroupSettingTemplate> AddAsync(GroupSettingTemplate groupSettingTemplate, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <GroupSettingTemplate>(groupSettingTemplate, cancellationToken));
 }
 /// <summary>
 /// Adds the specified GroupSettingTemplate to the collection via POST.
 /// </summary>
 /// <param name="groupSettingTemplate">The GroupSettingTemplate to add.</param>
 /// <returns>The created GroupSettingTemplate.</returns>
 public System.Threading.Tasks.Task <GroupSettingTemplate> AddAsync(GroupSettingTemplate groupSettingTemplate)
 {
     return(this.AddAsync(groupSettingTemplate, CancellationToken.None));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="groupSettingTemplateToInitialize">The <see cref="GroupSettingTemplate"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(GroupSettingTemplate groupSettingTemplateToInitialize)
 {
 }