mapbox / mapbox-directions-swift

Traffic-aware directions and map matching in Swift on iOS, macOS, tvOS, watchOS, and Linux
https://www.mapbox.com/navigation/
ISC License
183 stars 88 forks source link

Exposing toll fees #749

Closed Udumft closed 1 year ago

Udumft commented 2 years ago

The PR adds Route.tollCosts and RouteOptions.computeTollCost for requesting and working with toll fees. Marking new properties and types with :nodoc: and skipping CHANGELOG update since it is a private API feature.

Udumft commented 1 year ago

So I've updated TollPrice to the flat representation. It should be easier to read and understand for developers and it still has some possibilities for foreignMembers coding. It is capable of detecting new types of payment methods and new categories. New parameters are handled on the toll price object itself, but it won't handle new properties anywhere else.

1ec5 commented 1 year ago

It is capable of detecting new types of payment methods and new categories. New parameters are handled on the toll price object itself, but it won't handle new properties anywhere else.

I think this is consistent with the JSON format. In case the API introduces new payment methods or vehicle categories that we don’t recognize, TollPaymentMethod and TollCategory are both extensible enumerations; the unrecognized values would just be strings without symbols.