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

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

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