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

new method - FollowLocation/Next link #2597

Closed
baywet opened this issue Apr 21, 2023 · 3 comments
Closed

new method - FollowLocation/Next link #2597

baywet opened this issue Apr 21, 2023 · 3 comments
Assignees
Labels
enhancement New feature or request generator Issues or improvements relater to generation capabilities. needs more information
Milestone

Comments

@baywet
Copy link
Member

baywet commented Apr 21, 2023

there are multiple scenarios on APIs that return a link to a resources:

  • paging returns a link to the next page
  • long running operations return a link to the status monitor resource
  • creation might return a location with 201 (not followed by the redirect handler)

We currently already generate a constructor overload for a raw URL, but finding the constructor is hard for client users.

We could emit a method named "FollowLocation(uri)" next to the Get/Post method that people would call, with the next link they received from the initial call.

Pseudo code example

var firstPage = await client.Users.GetAsync();
var secondPage = await client.Users.FollowLocationAsync(firstPage.NexLink);

We'd need an extension to trigger the generation of that method, next steps @darrelmiller to spec out the extension

@baywet baywet added enhancement New feature or request needs more information generator Issues or improvements relater to generation capabilities. labels Apr 21, 2023
@baywet baywet added this to the Kiota v1.4 milestone Apr 21, 2023
@baywet baywet added this to Kiota Apr 21, 2023
@github-project-automation github-project-automation bot moved this to Todo in Kiota Apr 21, 2023
@baywet baywet modified the milestones: Kiota v1.4, Kiota v1.5 Jun 9, 2023
@isvargasmsft
Copy link
Contributor

@baywet
Copy link
Member Author

baywet commented Aug 1, 2023

@isvargasmsft I'm not sure how this is a good example for this issue since we're already projecting a code path and it the location header is returned with a 302. Our middleware should follow it already today. https://github.com/microsoftgraph/msgraph-sdk-dotnet/blob/e8d45240d46a84c12ccd683bac59c454ab02b017/src/Microsoft.Graph/Generated/Reports/GetSharePointSiteUsageDetailWithPeriod/GetSharePointSiteUsageDetailWithPeriodRequestBuilder.cs#L41

@baywet baywet modified the milestones: Kiota v1.5, Kiota v1.6 Aug 1, 2023
@darrelmiller
Copy link
Member

We have decided to not do this work as there is currently insufficient information in the OpenAPI description to enable a good developer experience.

  • Knowing the location URL in a 201 or 202 does not allow us to know the return type
  • Paging can be addressed in other mechanism such as the page iterator, or future GetAll() implementions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request generator Issues or improvements relater to generation capabilities. needs more information
Projects
Archived in project
Development

No branches or pull requests

3 participants