Skip to content
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

Merged
merged 4 commits into from
May 28, 2024
Merged

feat: add actions API in client #818

merged 4 commits into from
May 28, 2024

Conversation

j33ty
Copy link
Contributor

@j33ty j33ty commented May 22, 2024

Add new Actions API implementation: https://www.sanity.io/docs/http-actions

Methods implemented:

  1. create: A create action creates a new draft document.
  2. replaceDraft: A replaceDraft action replaces an existing draft document.
  3. edit: An edit action is used to modify an existing draft document. It applies the given patch to the document referenced by draftId.
  4. delete: A delete action is used to delete the published version of a document and optionally some (likely all known) draft versions.
  5. discard: A discard action is used to delete the draft version of a document.
  6. 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.
  7. 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.

@j33ty j33ty self-assigned this May 22, 2024
@j33ty j33ty requested review from a team and bjoerge May 22, 2024 08:42
Copy link
Member

@bjoerge bjoerge left a 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.

src/data/action.ts Outdated Show resolved Hide resolved
src/types.ts Outdated Show resolved Hide resolved
src/types.ts Outdated Show resolved Hide resolved
src/types.ts Show resolved Hide resolved
@stipsan stipsan changed the title Add actions API in client feat: add actions API in client May 23, 2024
@stipsan
Copy link
Member

stipsan commented May 23, 2024

@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 :)

rneatherway
rneatherway previously approved these changes May 23, 2024
Copy link
Contributor

@rneatherway rneatherway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All my comments are addressed. I'll defer to @bjoerge or @stipsan for final review.

src/types.ts Show resolved Hide resolved
src/types.ts Show resolved Hide resolved
Copy link
Member

@stipsan stipsan left a 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 ☺️

@bjoerge bjoerge merged commit 03c15a9 into main May 28, 2024
16 checks passed
@bjoerge bjoerge deleted the cldx-2126 branch May 28, 2024 08:51
@ecospark ecospark bot mentioned this pull request May 28, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants