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