Skip to content

feat: Add EU tripinfo speed/duration fetching - #45

Open
chetanjain2099 wants to merge 4 commits into
schmidtwmark:mainfrom
chetanjain2099:main
Open

feat: Add EU tripinfo speed/duration fetching#45
chetanjain2099 wants to merge 4 commits into
schmidtwmark:mainfrom
chetanjain2099:main

Conversation

@chetanjain2099

Copy link
Copy Markdown
Contributor

Hi, I have added the drive average speed, max speed and drive duration for the daily trip. I am not sure whether it is possible to get an individual trip with energy usage. For the interim, this should work.

IMG_5094 IMG_5095

Comment thread Sources/BetterBlueKit/API/HyundaiEurope/HyundaiEuropeAPIClient.swift Outdated
…. Added a new `fetchEVTripInfo` method to `APIClientProtocol` so clients can fetch the extra trip data separately, only when required.
@chetanjain2099
chetanjain2099 marked this pull request as draft July 24, 2026 16:53
@chetanjain2099

Copy link
Copy Markdown
Contributor Author

Make BetterBlueKit stateless and separate individual trip fetching.
Implement individual EV Trip Info fetching for Hyundai Europe. Will return null for unsupported countries.

image image

@chetanjain2099
chetanjain2099 marked this pull request as ready for review July 24, 2026 17:11

@schmidtwmark schmidtwmark left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the improvements, this is looking better. Hopefully some minor changes to clear this up, then I'll take a look at the BetterBlue app changes in your other PR

return try parseEVTripDetailsResponse(data, vehicle: vehicle)
}

public func fetchEVTripInfo(for vehicle: Vehicle, authToken: AuthToken, dateString: String) async throws -> [EVTripInfo]? {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make the dateString an actual Date object, which then gets turned into a string inside the fetchEVTripInfo. It will make the interface a lot cleaner, and minimizes funny business with European/American dates if this endpoint is supported in the US in the future


/// Represents summary of a specific trip from the tripinfo endpoint
public struct EVTripInfo: Codable, Hashable, Sendable {
public let date: String

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use stronger types here -- Date, Distance, and Duration

func fetchEVTripInfo(for vehicle: Vehicle, authToken: AuthToken, dateString: String) async throws -> [EVTripInfo]?

/// Returns true if this API client implements `fetchEVTripDetails`
func supportsEVTripDetails() -> Bool

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can clear up all the naming here. Instead of having EVTripDetails and EVTripInfo, which is super unclear, we could have EVTripsSummary and EVTripInfo.

This supportsEVTripDetails() would then return a list of EVTripType enums. US would return [EVTripSummary], EU would return [EVTripSummary, EVTripInfo]

@chetanjain2099 chetanjain2099 changed the title feat: Add EU tripinfo speed/duration fetching with local caching feat: Add EU tripinfo speed/duration fetching Jul 29, 2026
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

Successfully merging this pull request may close these issues.

2 participants