storyblok / storyblok-js-client

Universal JavaScript client for Storyblok's API
MIT License
129 stars 87 forks source link

with_slug missing in types in Management API (also others params missing) #528

Open marckraw opened 1 year ago

marckraw commented 1 year ago

Expected Behavior

Documentation for management api and delivery api should be in sync with actual storyblok-js-client and its typescript types. If it's not, its hard to understand what is the current API.

Current Behavior

https://www.storyblok.com/docs/api/management#core-resources/stories/retrieve-multiple-stories

Documentation said that i can use with_slug param, but it looks like types are not aware of that:

CleanShot 2023-04-12 at 09 39 15@2x

Other params not existing in type:

It looks like, it is just type problem, becasue when I do it with @ts-ignore:

const storiesWithoutContent: any = await sbApi
        .get(`spaces/${spaceId}/stories/`, {
            per_page: 100,
            // @ts-ignore
            with_slug: 'folder/story-inside-folder'
        })
        .then((res: any) => res.data.stories)
        .catch((err: any) => console.error(err));

than it returns filtered result.

Steps to Reproduce

Just create a repo with storyblok-js-client@5.8.0, use typescript, and try to make request with with_slug param.

marckraw commented 1 year ago

well, didn't realize that i've created duplicated of this https://github.com/storyblok/storyblok-js-client/issues/477 🤦🏻 documented others missing types, so I guess will not close it yet :P

marckraw commented 1 year ago

Actually not a duplicate, but also about types, but this time the missing types for params not a result.

thiagosaife commented 1 year ago

@marckraw Hello, sir. We have an open pull request ready to be QA'd that solves this issues. I'll keep you posted here. Thanks for the heads up.

javierdebug commented 1 year ago

Hey, in the end, this wasn't resolved. I had issues with that; the solution was to use .js instead of .ts. Are there any updates about it?

thiagosaife commented 1 year ago

@javierdebug Not yet, sir. We'll close this issue when done. I'll keep you posted here.

rasmusbe commented 10 months ago

Any news about getting correct types for the Management API Client?

thiagosaife commented 10 months ago

@rasmusbe Yes, pull request is opened extending all these missing types. Keep you posted.

thiagosaife commented 10 months ago

@rasmusbe Please, try out the latest version. I'll close this thread, but feel free to re open it if this wasn't solved.

rasmusbe commented 10 months ago

I need to try it more next week when I'm back at work I tried it quickly and it seems like the put and post input parameters and response is still wrong.

image
rasmusbe commented 10 months ago

And I dont seems to be able to reopen the issue

thiagosaife commented 10 months ago

@rasmusbe That's weird. post and put they have ISbStoriesParams as their interface to params, which was extended with the missing types. Can you please share a test case when you have the time? Please do not share any sensitive data.

rasmusbe commented 8 months ago

I'm sorry for the delay. i haven't had the time to do a test case but here's some stuff I found:

alvarosabu commented 3 months ago

Hi @marckraw @rasmusbe @javierdebug I just found this issue while triaging and cleaning out issues

I would assume this is still relevant, so I will add it to my priorities.

Thanks a lot, everyone for your patience 🙏🏻