Upgrade SDK to support Payload API V2#18
Merged
Conversation
7059b0a to
d7eef8e
Compare
RickRen7575
approved these changes
Jan 21, 2026
|
|
||
| ```python | ||
| import payload as pl | ||
| pl.api_key = 'secret_key_3bW9JMZtPVDOfFNzwRdfE' |
There was a problem hiding this comment.
I assume this isn't a real secret key?
| ) | ||
| ``` | ||
|
|
||
| API v2 introduces new objects including `Profile`, `Intent`, `Entity`, `Transfer`, `ProcessingAgreement`, and more. See the [Payload API Documentation](https://docs.payload.com) for details on API versions. |
There was a problem hiding this comment.
Will you wait to merge until the docs are live?
Contributor
Author
There was a problem hiding this comment.
No, we need to get these out so we can expose the docs.
| User, | ||
| Webhook, | ||
| ) | ||
| from .version import __version__ |
There was a problem hiding this comment.
Why did you have to adjust all of these imports?
Contributor
Author
There was a problem hiding this comment.
So we don't use * imports which is considered bad practice.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 PR adds support for Payload API v2 by implementing version pinning functionality. The SDK now allows users to specify which API version they want to use via the
api_versionparameter, which is sent as theX-API-Versionheader on all API requests.This change enables developers to:
Changes include:
api_versionparameter toSessionclass and globalpayloadmoduleX-API-Versionheader inARMRequest._request()for all HTTP methodspayload/__init__.py__all__declaration for explicit public API definitionint/(integration tests) andunit/directoriesapi_versionheader functionalityType of change
Implementation Details
API Version Support
The
api_versionparameter can be set in three ways:None: When not set, no version header is sent