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

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

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

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