go-shopify
go-shopify copied to clipboard
Why does `StorefrontAccessTokenService` accept a `StorefrontAccessToken`?
If I wanted to create a storefront access token, why do I have to pass in a StorefrontAccessToken
?
type StorefrontAccessTokenService interface {
List(context.Context, interface{}) ([]StorefrontAccessToken, error)
Create(context.Context, StorefrontAccessToken) (*StorefrontAccessToken, error)
Delete(context.Context, uint64) error
}
The api is
curl -d '{"storefront_access_token":{"title":"Test"}}' \
-X POST "https://your-development-store.myshopify.com/admin/api/2024-01/storefront_access_tokens.json" \
-H "X-Shopify-Access-Token: {access_token}" \
-H "Content-Type: application/json"
Seems that only the title
is required?
You're right, that seems like a bug, thanks for reporting!
Just looked at this again and I think this is fine.
See the docs here: https://shopify.dev/docs/api/admin-rest/2024-04/resources/storefrontaccesstoken#post-storefront-access-tokens
Looks like only title
is relevant but the whole storefrontaccesstoken
object is passed.
Let's leave this as is.