Resume a Shoot

This section explains how to resume a shoot for a vehicle, regardless of whether the previous shoot was in Draft, Completed, or Failed. The spyneSDK.startShoot() function handles all scenarios, with the SDK automatically deciding whether to continue, resume, or start a new shoot.


1. Vehicle Matching Logic

The SDK uses the following vehicle identifiers to determine whether to resume, continue, or start a new shoot:

  • vin (Vehicle Identification Number)
  • stockNumber
  • registrationNumber

If any of these match an existing vehicle, the SDK will resume the shoot or start a reshoot based on the vehicle’s previous state.

If no match is found, a new shoot will be created.


2. Resume a Shoot (Draft, Completed, or Failed)

You only need to call the startShoot() function. The SDK will handle:

  • New Shoot: If no matching vehicle is found.
  • Resume Draft: If the vehicle has an unfinished shoot.
  • Reshoot: If the previous shoot was completed or failed.
let shootData = ShootData(
    vin: vin,
    stockNumber: stockNumber,
    registrationNumber: registrationNumber
)

let spyneSDK = SpyneAutomobileSDK.Builder(
    viewController: self,
    delegate: self
)
.setUserData(UserData(userId: "\(userId)"))
.setShootData(shootData)
.setEnvironment(.staging)
.setLocale(“en”)
.build()

spyneSDK.startShoot()

Key Points:

  • One function (startShoot()) handles starting, resuming, or restarting the shoot.
  • The SDK checks the vehicle’s existing data and automatically determines the appropriate action.
  • You do not need to specify the shoot state (Draft, Completed, Failed).

3. Key Considerations

  • Vehicle Matching: The SDK uses any of the identifiers (vin, stockNumber, registrationNumber) to match the vehicle.
  • Automatic State Handling: You don’t need to pass the shoot state; the SDK resolves it internally.

Note: If identifiers like vin1 and stock1 are reused, the SDK will continue the first shoot.


4. Error Handling

  • Mismatched Identifiers: If you change the identifiers (vin, stockNumber, registrationNumber), the SDK will treat it as a new shoot.
  • Invalid Data: Ensure that the vin is 17 characters long and properly formatted to avoid errors.