Closed Swimburger closed 2 days ago
Decisions:
The mockResponse
is generated incorrectly in ListWithExtendedResultsAndOptionalDataTest
and ListWithExtendedResultsTest
.
The mockresponse JSON should have the data
property. The list within data
is optional so that's fine, but there should be a data: {}
property since that isn't optional in Fern definition.
Improvements:
setCursor
and setOffset
For initializing towards cursor and offset property, I assume the types don't have required fields and initialize an empty instance using ?? = new()
.
I'm worried if one of these types does have a required field, at which point the compiler will complain.
I added a shallow clone using the record with {}
feature. Future versions of C# may include a DeepClone feature for records.
This feature works, but the code is still a little rough and needs some cleaning.
HttpPagerEndpointGenerator
generates pager methods that use the main endpoint methods for users to paginate over items in a paginated endpoint.AsIs/Page.Template.cs
holds a list of items in a single pageAsIs/Pager.Template.cs
has a public abstractPager<Item>
class for a user to interact with, and two internal implementationsOffsetPager
and CursorPager`. The bulk of the logic to paginate is stored within these implementations, and the remaining parts are passed into the pagers as delegates.⚠️ Assumption: For cursor-based pagination, the cursor is assumed to be a string. This is probably correct in 95% of cases, but that's just a guess. Does the cursor type need to be configurable?
⚠️ Big change: The generator thus far assumes that each endpoint generates one method on a client. This PR changes that so that an endpoint generator can generate multiple methods. For generated SDKs, this isn't too big of a change, but this also affects generated snippets and references. There's some code duplication to quickly get snippets and references to work as expected with this pager variation method for the endpoint