azure-sdk-for-cpp icon indicating copy to clipboard operation
azure-sdk-for-cpp copied to clipboard

fix move to next page in paged response

Open gearama opened this issue 1 year ago • 1 comments

closes #5617

Pull Request Checklist

Please leverage this checklist as a reminder to address commonly occurring feedback when submitting a pull request to make sure your PR can be reviewed quickly:

See the detailed list in the contributing guide.

  • [ ] C++ Guidelines
  • [ ] Doxygen docs
  • [ ] Unit tests
  • [ ] No unwanted commits/changes
  • [ ] Descriptive title/description
    • [ ] PR is single purpose
    • [ ] Related issue listed
  • [ ] Comments in source
  • [ ] No typos
  • [ ] Update changelog
  • [ ] Not work-in-progress
  • [ ] External references or docs updated
  • [ ] Self review of PR done
  • [ ] Any breaking changes?

gearama avatar May 15 '24 19:05 gearama

FWIW, here is what code our current codegen would generate for pageable:

  • hpp: https://github.com/Azure/autorest.cpp/blob/next/packages/typespec-cpp/test/cadl-ranch/http/payload/pageable/generated/inc/payload/pageable/rest_client.hpp
  • cpp: https://github.com/Azure/autorest.cpp/blob/next/packages/typespec-cpp/test/cadl-ranch/http/payload/pageable/generated/src/rest_client.cpp

I didn't find a private constructor there, but the codegen is essentially doing the same by doing this:

  ListPagedResponse response{};
  response.m_client = std::make_shared<PageableClient>(*this);
  response.m_options = options;

I am not proposing that you necessarily should remove the constructor, but I am more making an argument for the construction being private.

antkmsft avatar May 16 '24 02:05 antkmsft