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