/// <summary> /// Updates the specified TagOperation using PATCH. /// </summary> /// <param name="tagOperationToUpdate">The TagOperation to update.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <exception cref="Microsoft.Graph.ClientException">Thrown when an object returned in a response is used for updating an object in Microsoft Graph.</exception> /// <returns>The updated TagOperation.</returns> public async System.Threading.Tasks.Task <TagOperation> UpdateAsync(TagOperation tagOperationToUpdate, CancellationToken cancellationToken) { if (tagOperationToUpdate.AdditionalData != null) { if (tagOperationToUpdate.AdditionalData.ContainsKey(Microsoft.Graph.Constants.HttpPropertyNames.ResponseHeaders) || tagOperationToUpdate.AdditionalData.ContainsKey(Microsoft.Graph.Constants.HttpPropertyNames.StatusCode)) { throw new Microsoft.Graph.ClientException( new Microsoft.Graph.Error { Code = Microsoft.Graph.GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(Microsoft.Graph.GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, tagOperationToUpdate.GetType().Name) }); } } if (tagOperationToUpdate.AdditionalData != null) { if (tagOperationToUpdate.AdditionalData.ContainsKey(Microsoft.Graph.Constants.HttpPropertyNames.ResponseHeaders) || tagOperationToUpdate.AdditionalData.ContainsKey(Microsoft.Graph.Constants.HttpPropertyNames.StatusCode)) { throw new Microsoft.Graph.ClientException( new Microsoft.Graph.Error { Code = Microsoft.Graph.GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(Microsoft.Graph.GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, tagOperationToUpdate.GetType().Name) }); } } this.ContentType = "application/json"; this.Method = "PATCH"; var updatedEntity = await this.SendAsync <TagOperation>(tagOperationToUpdate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(updatedEntity); return(updatedEntity); }
/// <summary> /// Creates the specified TagOperation using POST. /// </summary> /// <param name="tagOperationToCreate">The TagOperation to create.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created TagOperation.</returns> public async System.Threading.Tasks.Task <TagOperation> CreateAsync(TagOperation tagOperationToCreate, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; var newEntity = await this.SendAsync <TagOperation>(tagOperationToCreate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(newEntity); return(newEntity); }
/// <summary> /// Creates the specified TagOperation using POST. /// </summary> /// <param name="tagOperationToCreate">The TagOperation to create.</param> /// <returns>The created TagOperation.</returns> public System.Threading.Tasks.Task <TagOperation> CreateAsync(TagOperation tagOperationToCreate) { return(this.CreateAsync(tagOperationToCreate, CancellationToken.None)); }
/// <summary> /// Initializes any collection properties after deserialization, like next requests for paging. /// </summary> /// <param name="tagOperationToInitialize">The <see cref="TagOperation"/> with the collection properties to initialize.</param> private void InitializeCollectionProperties(TagOperation tagOperationToInitialize) { }