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

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

            return(newEntity);
        }
 /// <summary>
 /// Updates the specified TeamsTemplate using PATCH.
 /// </summary>
 /// <param name="teamsTemplateToUpdate">The TeamsTemplate to update.</param>
 /// <returns>The updated TeamsTemplate.</returns>
 public System.Threading.Tasks.Task <TeamsTemplate> UpdateAsync(TeamsTemplate teamsTemplateToUpdate)
 {
     return(this.UpdateAsync(teamsTemplateToUpdate, CancellationToken.None));
 }
 /// <summary>
 /// Adds the specified TeamsTemplate to the collection via POST.
 /// </summary>
 /// <param name="teamsTemplate">The TeamsTemplate to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created TeamsTemplate.</returns>
 public System.Threading.Tasks.Task <TeamsTemplate> AddAsync(TeamsTemplate teamsTemplate, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <TeamsTemplate>(teamsTemplate, cancellationToken));
 }
示例#5
0
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="teamsTemplateToInitialize">The <see cref="TeamsTemplate"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(TeamsTemplate teamsTemplateToInitialize)
 {
 }