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

Add published param to Page #305

Merged
merged 2 commits into from
Sep 1, 2024

Conversation

k-yomo
Copy link

@k-yomo k-yomo commented Aug 25, 2024

This PR adds Published field to Page to make it possible to pass published parameter for create/update.
Also not to let user confuse, the field will be consistent with published_at when it's read.

curl -d '{"page":{"title":"Warranty information","body_html":"<h2>Warranty</h2>\n<p>Returns accepted if we receive items <strong>30 days after purchase</strong>.</p>","published":false}}' \
-X POST "https://your-development-store.myshopify.com/admin/api/2024-07/pages.json" \
-H "X-Shopify-Access-Token: {access_token}" \
-H "Content-Type: application/json"

https://shopify.dev/docs/api/admin-rest/2024-07/resources/page#post-pages-examples

@oliver006
Copy link
Collaborator

Thanks for the PR!
If the published field isn't returned than we should make it optional, e.g. nullable and not populate when we think we know what the value should be.
So let's just change published to *bool and no longer set it based on the published_at value when parsing a response and we should be good to go.

@k-yomo
Copy link
Author

k-yomo commented Aug 29, 2024

@oliver006
Thanks for the review!
I fixed published to *bool as suggested!

Copy link
Collaborator

@oliver006 oliver006 left a comment

Choose a reason for hiding this comment

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

Looks good - thanks for the PR!

@oliver006 oliver006 merged commit 730f4f4 into bold-commerce:master Sep 1, 2024
3 checks passed
@k-yomo k-yomo deleted the add-published-param-to-page branch September 2, 2024 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants