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

Missing types for fetching links query params #909

Closed
bevanmw opened this issue Dec 23, 2024 · 4 comments · Fixed by #911
Closed

Missing types for fetching links query params #909

bevanmw opened this issue Dec 23, 2024 · 4 comments · Fixed by #911
Assignees
Labels
bug Something isn't working released

Comments

@bevanmw
Copy link

bevanmw commented Dec 23, 2024


Current Behavior

You can fetch the links via this API (https://www.storyblok.com/docs/api/content-delivery/v2/links/retrieve-multiple-links) by using the js client:

const { data } = await storyblokApi?.get(`cdn/links`, {
  version: 'draft',
  include_dates: 1
});

However the get method expects the second param to be of type ISbStoriesParams which is not the same as the query params that are accepted by the API: https://www.storyblok.com/docs/api/content-delivery/v2/links/retrieve-multiple-links.

Also, the type ISbLink does not include the published_at, created_at and updated_at fields that are included when include_dates is set to 1.

Expected Behavior

I propose that there should be a dedicated getLinks method like there is for getStories. Which takes in the correct query params for fetching links.

Steps to Reproduce

Screenshot 2024-12-23 at 10 40 19

  1. Try to add include_dates parameter to get method which fetching cdn/links
  2. Typescript error despite the query parameter working as documented here: https://www.storyblok.com/docs/api/content-delivery/v2/links/retrieve-multiple-links
  3. updated_at field not present on ISbLink:
    Screenshot 2024-12-23 at 10 43 17
    Screenshot 2024-12-23 at 10 44 49
@edodusi edodusi self-assigned this Dec 23, 2024
@edodusi edodusi added the bug Something isn't working label Dec 23, 2024
@edodusi
Copy link
Contributor

edodusi commented Dec 23, 2024

@bevanmw I would not add a dedicated endpoint for links, as an overload should be enough. I fixed the type errors in this PR #911 if you want to check it out, we will review and merge it soon.

Thanks for reporting the error!

@bevanmw
Copy link
Author

bevanmw commented Dec 23, 2024

Thanks @edodusi ! Yes, an overload is much better solution. I checked out your fix and it works really well.

@edodusi
Copy link
Contributor

edodusi commented Dec 23, 2024

Thanks @bevanmw, it will go through our review process and we'll release it soon, also with updates to our SDKs

Copy link

🎉 This issue has been resolved in version 6.10.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants