-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add actions API in client #818
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, Radhe – would love to see some unit tests here as well, if possible.
See also suggestion re: unused file below.
@j33ty quick heads up, I changed the PR title so it uses semantic prefixing. I noticed you use them for the commits 👍 We usually have them in PR titles as well since "squash & merge" is frequently used, and ensures that regardless of merge method the new version that will be published, and the changelog entries, are correct :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…I and simplify DX
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good from my perspective 👍 I didn't enable auto merge so that @bjoerge has the opportunity to do the final approval
Add new Actions API implementation: https://www.sanity.io/docs/http-actions
Methods implemented:
create
: A create action creates a new draft document.replaceDraft
: A replaceDraft action replaces an existing draft document.edit
: An edit action is used to modify an existing draft document. It applies the given patch to the document referenced by draftId.delete
: A delete action is used to delete the published version of a document and optionally some (likely all known) draft versions.discard
: A discard action is used to delete the draft version of a document.publish
: A publish action is used to publish a draft document. If a published version of the document already exists this is replaced by the current draft document.unpublish
: An unpublish action is used to retract a published document. If there is no draft version then this is created from the published version.