Named Driver

SDK introduces Named driver API for family functionality to add secondary drivers by host app

Fetch

Use the API to retrieve the array of named drivers

Required Information:

*Identity: In order to activate device, the application must have a valid user (represented by the Identity). That user must be active.

Concrete Example

To fetch the Named Drivers details, one can use the following snippet

let service = NamedDriverService(identity: identity)
service.fetch(then: { result in
    switch result {
    case: .success(_)
        // successfully retrieved
    case: .failure(_)
        // failure error
    }
})

Update

Updates the named driver's email and phone number and returns the updated named driver object

Required Information:

*Identity: In order to activate device, the application must have a valid user (represented by the Identity). That user must be active.

Parameters:

  • userId: User id of a named driver retrieved from fetch api

  • email: Email to be updated

  • phone: Phone number to be updated

To update the named driver's details, first host app needs to retrieve the user Id provided when the fetch API call is made and need to provide the retrieved user id as an argument to updateNamedDriver API

Concrete Example

To update the Named Drivers details, one can use the following snippet

let service = NamedDriverService(identity: identity)
service.updateNamedDriver(userId: Int,
                          email: String,
                          phone: String,
                          then: { result in
    switch result {
    case: .success(_)
        // successfully updated
    case: .failure(_)
        // failure error
    }
})

Error codes

  • fetch

    • 404 -> No Named Drivers Found

  • updateNamedDriver

    • 409 -> Conflict email exists for another user

    • 404 -> Failed to locate named driver for primary policy holder

Last updated