Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch request in v5 beta should return updated object #478

Closed
gaspik opened this issue Jun 22, 2022 · 2 comments
Closed

Patch request in v5 beta should return updated object #478

gaspik opened this issue Jun 22, 2022 · 2 comments
Assignees
Labels

Comments

@gaspik
Copy link

gaspik commented Jun 22, 2022

Is your feature request related to a problem? Please describe.
In v4 of the client library, updating an item (via PATCH) causes server to return the updated item. This was also understood by clien library and object was returned.

We use etag to track version changes, so after PATCH we just stored new etag. In v5.6 beta preview, the PatchAsync method returns Task without the underlying type, not parsing the response

Describe the solution you'd like
PatchAsync should return Task where T is the object you are updating. This would save us one request trip to server. The data is already in the response, it just needs to be processed/parsed properly by the client library

Sample code now:

var request = GraphServiceClient.Me.Events[uniqueId];				
await request.PatchAsync(graphItem, rc =>
				{
					if (versionId != null)
						rc.Headers.Add("If-Match", versionId);
				},
				cancellationToken: cancellationToken);
storedEvent = await GraphServiceClient.RequestAdapter.SendAsync<Event>(
					GetSingleItemRequest(folder, uniqueId),
					Event.CreateFromDiscriminatorValue,
					cancellationToken: cancellationToken);

Expectation is to be able to execute:

var request = GraphServiceClient.Me.Events[uniqueId];				
var storedEvent = await request.PatchAsync(graphItem, rc =>
				{
					if (item.DataObject.VersionId != null)
						rc.Headers.Add("If-Match", versionId);
				},
				cancellationToken: cancellationToken);
@ghost ghost added the Needs: Triage label Jun 22, 2022
@andrueastman andrueastman self-assigned this Jun 30, 2022
@ghost ghost removed the Needs: Triage label Jun 30, 2022
@andrueastman
Copy link
Member

Thanks for trying out the new preview @gaspik.

The generator is currently generating void methods due to the schema provided in the openApi reference document. This is currently being tracked via microsoft/kiota#1699 to allow for range responses in the schema.

@andrueastman
Copy link
Member

Closed via #545

@ghost ghost locked as resolved and limited conversation to collaborators Oct 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants