112: Add a method for requesting a form definition #121
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.
Closes #112
What has been done to verify that this works as intended?
Added unit test for the str/bytes code path, and client test to check against Central that the endpoint returns something that looks like XForms XML.
Why is this the best possible solution? Were any other approaches considered?
Follows the same code pattern as forms.get, except for returning a document so pydantic isn't used. An option was included to get the response bytes as-is since this can go to XML parsing libraries like lxml rather than bytes -> str -> parse. For the str/bytes control I considered requiring "encoding='bytes'" but "None" seemed a bit more intuitive in that bytes is not decoded. It could also be true/false flag but then it wouldn't be easy to specify a different encoding and there are some other endpoints that expose encoding options e.g. submissions.create.
How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
Adds a new user-requested endpoint.
Do we need any specific form for testing your changes? If so, please attach one.
N/A existing test fixtures were used.
Does this change require updates to documentation? If so, please file an issue here and include the link below.
No the details are in the docstring.
Before submitting this PR, please make sure you have:
testspython -m unittestand verified all tests passruff format pyodk testsandruff check pyodk teststo lint code