/// <summary> /// Updates the specified TeamsApp using PATCH. /// </summary> /// <param name="teamsAppToUpdate">The TeamsApp 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 TeamsApp.</returns> public async System.Threading.Tasks.Task <TeamsApp> UpdateAsync(TeamsApp teamsAppToUpdate, CancellationToken cancellationToken) { if (teamsAppToUpdate.AdditionalData != null) { if (teamsAppToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || teamsAppToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, teamsAppToUpdate.GetType().Name) }); } } if (teamsAppToUpdate.AdditionalData != null) { if (teamsAppToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || teamsAppToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, teamsAppToUpdate.GetType().Name) }); } } this.ContentType = "application/json"; this.Method = "PATCH"; var updatedEntity = await this.SendAsync <TeamsApp>(teamsAppToUpdate, cancellationToken).ConfigureAwait(false); return(updatedEntity); }
/// <summary> /// Creates the specified TeamsApp using POST. /// </summary> /// <param name="teamsAppToCreate">The TeamsApp to create.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created TeamsApp.</returns> public async System.Threading.Tasks.Task <TeamsApp> CreateAsync(TeamsApp teamsAppToCreate, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; var newEntity = await this.SendAsync <TeamsApp>(teamsAppToCreate, cancellationToken).ConfigureAwait(false); return(newEntity); }
/// <summary> /// Updates the specified TeamsApp using PATCH. /// </summary> /// <param name="teamsAppToUpdate">The TeamsApp to update.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The updated TeamsApp.</returns> public async System.Threading.Tasks.Task <TeamsApp> UpdateAsync(TeamsApp teamsAppToUpdate, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "PATCH"; var updatedEntity = await this.SendAsync <TeamsApp>(teamsAppToUpdate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(updatedEntity); return(updatedEntity); }
/// <summary> /// Initializes any collection properties after deserialization, like next requests for paging. /// </summary> /// <param name="teamsAppToInitialize">The <see cref="TeamsApp"/> with the collection properties to initialize.</param> private void InitializeCollectionProperties(TeamsApp teamsAppToInitialize) { if (teamsAppToInitialize != null && teamsAppToInitialize.AdditionalData != null) { if (teamsAppToInitialize.AppDefinitions != null && teamsAppToInitialize.AppDefinitions.CurrentPage != null) { teamsAppToInitialize.AppDefinitions.AdditionalData = teamsAppToInitialize.AdditionalData; object nextPageLink; teamsAppToInitialize.AdditionalData.TryGetValue("*****@*****.**", out nextPageLink); var nextPageLinkString = nextPageLink as string; if (!string.IsNullOrEmpty(nextPageLinkString)) { teamsAppToInitialize.AppDefinitions.InitializeNextPageRequest( this.Client, nextPageLinkString); } } } }
/// <summary> /// Creates the specified TeamsApp using POST. /// </summary> /// <param name="teamsAppToCreate">The TeamsApp to create.</param> /// <returns>The created TeamsApp.</returns> public System.Threading.Tasks.Task <TeamsApp> CreateAsync(TeamsApp teamsAppToCreate) { return(this.CreateAsync(teamsAppToCreate, CancellationToken.None)); }
/// <summary> /// Adds the specified TeamsApp to the collection via POST. /// </summary> /// <param name="teamsApp">The TeamsApp to add.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created TeamsApp.</returns> public System.Threading.Tasks.Task <TeamsApp> AddAsync(TeamsApp teamsApp, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; return(this.SendAsync <TeamsApp>(teamsApp, cancellationToken)); }
/// <summary> /// Adds the specified TeamsApp to the collection via POST. /// </summary> /// <param name="teamsApp">The TeamsApp to add.</param> /// <returns>The created TeamsApp.</returns> public System.Threading.Tasks.Task <TeamsApp> AddAsync(TeamsApp teamsApp) { return(this.AddAsync(teamsApp, CancellationToken.None)); }