Contents

handle(intent:completion:)

Provides a list of the user’s electric vehicles.

Declaration

func handle(intent: INListCarsIntent, completion: @escaping  @Sendable (INListCarsIntentResponse) -> Void)
func handle(intent: INListCarsIntent) async -> INListCarsIntentResponse

Parameters

  • intent:

    The intent object that represents the request.

  • completion:

    The block you call with your response. You must call this block within your implementation of this method and pass an instance of Inlistcarsintentresponse that contains a status code, and a list of the user’s electric vehicles, if available.

Discussion

Retrieve a list of the user’s electric vehicles and create an instance of INCar for each, setting carIdentifier to a unique identifier that represents that vehicle. The identifier matches the vehicle to future INGetCarPowerLevelStatusIntent requests. Do not use the vehicle’s VIN, or equivalent, as the identifier.

Before returning from this method, create a response with the appropriate status code and, if you can retrieve a list of the user’s electric vehicles, set the cars property to the array of INCar objects. Then call the completion block and pass the response.