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

getLoggedInAthleteActivites does not respect per_page parameter #112

Closed
ted-piotrowski opened this issue Nov 1, 2021 · 3 comments
Closed
Labels

Comments

@ted-piotrowski
Copy link

The following request should return one activity but returns the default 30:

await strava.activities.getLoggedInAthleteActivities({ per_page: 1 });

Same when requesting LatLng key in Streams, only the default distance stream is returned:

await strava.streams.getActivityStreams({ id: 5937416221, keys: [StreamKeys.LatLng] });

This behavior works as intended in 1.3.2, so it broken recently. I believe it's related to this change:

https://github.com/rfoel/strava/blob/main/src/request.ts#L54

Specifically, the new query serialisation code results in urls of the following format /athlete/activities?query=%5Bobject+Object%5D

Current workaround is to downgrade to 1.3.2.

@rfoel
Copy link
Owner

rfoel commented Nov 4, 2021

I'll check that out!

rfoel added a commit that referenced this issue Nov 5, 2021
@rfoel
Copy link
Owner

rfoel commented Nov 5, 2021

I fixed this bug and I will release the fix soon. I added tests to all endpoints to make sure the correct request is being sent.

Also I decided to make a breaking change to the api, so when you used

await strava.streams.getActivityStreams({ id: 5937416221, keys: [StreamKeys.LatLng] });

you can simply replace with

await strava.streams.getActivityStreams({ id: 5937416221, keys: 'latlng' });
// or 
await strava.streams.getActivityStreams({ id: 5937416221, keys: ['latlng'] });

It should autocomplete with the available keys for you now.

@rfoel rfoel closed this as completed in f0a967b Nov 5, 2021
github-actions bot pushed a commit that referenced this issue Nov 5, 2021
# [2.0.0](v1.4.0...v2.0.0) (2021-11-05)

### Bug Fixes

* fix query params ([f0a967b](f0a967b)), closes [#112](#112)

### BREAKING CHANGES

* ActivityType and StreamKeys are now template literal types, meaning that
whenever used before the user had to use the enum like [StreamKeys.LatLng]
now it should be replaced with simply ['latlng'] with the benefits of autocompleting.
@github-actions
Copy link

github-actions bot commented Nov 5, 2021

🎉 This issue has been resolved in version 2.0.0 🎉

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
Projects
None yet
Development

No branches or pull requests

2 participants