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