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

X-Total-Count missing from new LokaliseApi().keys.list #53

Closed
jamiejones93 opened this issue Jan 6, 2021 · 6 comments
Closed

X-Total-Count missing from new LokaliseApi().keys.list #53

jamiejones93 opened this issue Jan 6, 2021 · 6 comments
Assignees

Comments

@jamiejones93
Copy link

Describe the bug
The total count of keys is missing from the response from new LokaliseApi().keys.list

To Reproduce
Call new LokaliseApi().keys.list

Expected behavior
Expose X-Total-Count to a property in the response from new LokaliseApi().keys.list

Your environment:

  • Node version: v12.13.0
  • "@lokalise/node-api": "^5.3.0",

Additional information:
From this issue we found some headers had been added, but not including X-Total-Count

CC @ycmjason

@bodrovis bodrovis self-assigned this Jan 6, 2021
@bodrovis bodrovis added the bug Something isn't working label Jan 6, 2021
@bodrovis
Copy link
Collaborator

bodrovis commented Jan 6, 2021

Thank you for reporting this, I'll check asap!

@bodrovis
Copy link
Collaborator

bodrovis commented Jan 6, 2021

Meanwhile, I would recommend the following approach:

const keys = await lokaliseApi.keys.list({
        project_id: project_id,
        page: 2,
        limit: 3,
      });

lokaliseApi.keys.totalResults; // => should return total results properly

@bodrovis bodrovis added discussed-internally This is being discussed internally within the team. and removed bug Something isn't working labels Jan 6, 2021
@jamiejones93
Copy link
Author

Thank you @bodrovis !

@bodrovis bodrovis removed the discussed-internally This is being discussed internally within the team. label Jan 10, 2021
@bodrovis
Copy link
Collaborator

Okay, so we've discussed this, and for now the above approach is the only available one, but it should work properly for all collections that have pagination data. However, in the near future we'll work on a slightly different approach for obtaining pagination data. This will be a breaking change but nothing too serious. :)

@bodrovis
Copy link
Collaborator

bodrovis commented Feb 3, 2021

Please note that this issue is resolved in node SDK v6 which was released a couple of days ago. Now it's possible to fetch totalResults and other data directly from the objects (for example, projects.totalResults). However, this version has some breaking changes so please check the changelog https://lokalise.github.io/node-lokalise-api/additional_info/changelog

@jamiejones93
Copy link
Author

Thank you @bodrovis 🎉 !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants