Named Driver

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

Fetch

To fetch the Named Drivers details, the following API can be used.

Concrete Example

let service = NamedDriverService()
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

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, the following API can be used.

let service = NamedDriverService()
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