feat: add streamed-list-objects endpoint #163
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This introduces support for OpenFGA's
POST /stores/{store_id}/streamed-list-objects
endpoint.The pull request introduces:
streamed_list_objects()
method to the SDK client, simplifying the handling of the streaming endpoint for developers.stream()
method to the async/sync REST clients, which supports handling of streaming/chunked HTTP network requests.build_request()
method to the async/sync REST clients to handle the request-building steps shared by therequest()
andstream()
methods.handle_response_exception()
method to the async/sync REST clients to handle the HTTP response exception processing shared between therequest()
andstream()
methods._accumulate_json_lines()
private method to the async/sync REST clients to help collect and reassemble partially delivered packets from streaming/chunked HTTP network requests. This method is used bystream()
.streamed_list_objects_response
andstream_result_of_streamed_list_objects_response
models./example/streamed-list-objects
example app, demonstrating usage through both the asynchronous and synchronous clients.README
to demonstrate usage.pytest-asyncio
dependency to simplify working with async method tests.test/rest_test.py
andtest/sync/rest_test.py
test suites to target all methods in the refactored classes. It includes tests for the new streaming APIs.It changes:
_streaming
parameter on appropriate methods, which helps direct the flow ofrequest()
method of the async/sync REST clients.And removes:
GET(),
HEAD(),
OPTIONS(),
POST(),
PUT(),
PATCH(),
andDELETE()
helper methods from the async/sync REST clients, to streamline the class and reduce redundant code.Usage Example:
Using the async client:
You can also review the new
/example/streamed-list-objects/asynchronous.py
(orsynchronous.py
) app for a more detailed usage demo.References
This code is generated using the SDK Generator; the pull request, including these changes, can be reviewed at its repository here: openfga/sdk-generator#469
The relevant issue for tracking this feature can be found her: openfga/sdk-generator#76
Review Checklist
main