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

Gear ID Router is Int but requires String #23

Open
KurtisPayne opened this issue Jan 19, 2020 · 2 comments
Open

Gear ID Router is Int but requires String #23

KurtisPayne opened this issue Jan 19, 2020 · 2 comments

Comments

@KurtisPayne
Copy link

When making a call to the Strava API via Alamofire, the Router parameter only accepts Int values for the gear.id
However, the gear defined in the Strava API documentation is listed as a String.

Thoughts?

@FleetPhil
Copy link
Contributor

FleetPhil commented Jul 2, 2020

I'm hitting this problem as well.

In the Strava API there are 2 ways of getting gear:
1: Each 'detailed activity' contains a Gear object - this should work (although I've not tried it yet)
2: Router call athleteActivities returns an array of activities each containing a gear_id, which can then then be used in the Strava API (Router call gear) to get the Gear object.

Method 2 does not work in the library for 2 reasons:
a) gear_id is not decoded onto the Activity class. This is a simple fix to add public let gearID: String? to the class, and gearID = json["gear_id"].string to the init
b) As Kurtis pointed out, Router expects ID to be an Int, but gear_id is a String. As id is not used in any calculation but simply passed around I can't see why it can't be made into a String.

@FleetPhil
Copy link
Contributor

In Router.swift I just changed public typealias Id = Int to public typealias Id = String and it works (at least for the calls in my program). I also added support for gear_id as in my previous reply. I'll package these into a pull request

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

No branches or pull requests

2 participants