/// <summary> /// Updates the specified ActivityHistoryItem using PATCH. /// </summary> /// <param name="activityHistoryItemToUpdate">The ActivityHistoryItem 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 ActivityHistoryItem.</returns> public async System.Threading.Tasks.Task <ActivityHistoryItem> UpdateAsync(ActivityHistoryItem activityHistoryItemToUpdate, CancellationToken cancellationToken) { if (activityHistoryItemToUpdate.AdditionalData != null) { if (activityHistoryItemToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || activityHistoryItemToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, activityHistoryItemToUpdate.GetType().Name) }); } } if (activityHistoryItemToUpdate.AdditionalData != null) { if (activityHistoryItemToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || activityHistoryItemToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, activityHistoryItemToUpdate.GetType().Name) }); } } this.ContentType = "application/json"; this.Method = "PATCH"; var updatedEntity = await this.SendAsync <ActivityHistoryItem>(activityHistoryItemToUpdate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(updatedEntity); return(updatedEntity); }
/// <summary> /// Creates the specified ActivityHistoryItem using POST. /// </summary> /// <param name="activityHistoryItemToCreate">The ActivityHistoryItem to create.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created ActivityHistoryItem.</returns> public async System.Threading.Tasks.Task <ActivityHistoryItem> CreateAsync(ActivityHistoryItem activityHistoryItemToCreate, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; var newEntity = await this.SendAsync <ActivityHistoryItem>(activityHistoryItemToCreate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(newEntity); return(newEntity); }
/// <summary> /// Adds the specified ActivityHistoryItem to the collection via POST. /// </summary> /// <param name="activityHistoryItem">The ActivityHistoryItem to add.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created ActivityHistoryItem.</returns> public System.Threading.Tasks.Task <ActivityHistoryItem> AddAsync(ActivityHistoryItem activityHistoryItem, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; return(this.SendAsync <ActivityHistoryItem>(activityHistoryItem, cancellationToken)); }
/// <summary> /// Adds the specified ActivityHistoryItem to the collection via POST. /// </summary> /// <param name="activityHistoryItem">The ActivityHistoryItem to add.</param> /// <returns>The created ActivityHistoryItem.</returns> public System.Threading.Tasks.Task <ActivityHistoryItem> AddAsync(ActivityHistoryItem activityHistoryItem) { return(this.AddAsync(activityHistoryItem, CancellationToken.None)); }
/// <summary> /// Creates the specified ActivityHistoryItem using POST. /// </summary> /// <param name="activityHistoryItemToCreate">The ActivityHistoryItem to create.</param> /// <returns>The created ActivityHistoryItem.</returns> public System.Threading.Tasks.Task <ActivityHistoryItem> CreateAsync(ActivityHistoryItem activityHistoryItemToCreate) { return(this.CreateAsync(activityHistoryItemToCreate, CancellationToken.None)); }
/// <summary> /// Initializes any collection properties after deserialization, like next requests for paging. /// </summary> /// <param name="activityHistoryItemToInitialize">The <see cref="ActivityHistoryItem"/> with the collection properties to initialize.</param> private void InitializeCollectionProperties(ActivityHistoryItem activityHistoryItemToInitialize) { }
/// <summary> /// Adds the specified ActivityHistoryItem to the collection via PUT. /// </summary> /// <param name="activityHistoryItem">The ActivityHistoryItem to add.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created ActivityHistoryItem.</returns> public System.Threading.Tasks.Task <ActivityHistoryItem> AddActivityHistoryAsync(ActivityHistoryItem activityHistoryItem, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "PUT"; this.AppendSegmentToRequestUrl(activityHistoryItem.Id ?? Guid.NewGuid().ToString()); return(this.SendAsync <ActivityHistoryItem>(activityHistoryItem, cancellationToken)); }