> For the complete documentation index, see [llms.txt](https://docs.drivequant.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.drivequant.com/get-started-drivekit/ios/references.md).

# References

## DriveKitDelegate <a href="#drivekitdelegate" id="drivekitdelegate"></a>

`DriveKitDelegate` is a protocol that can be passed as a parameter during the [DriveKit Core module initialization](/get-started-drivekit/ios.md#drivekit-initialization). It gives useful events about the user lifecycle.

```swift
protocol DriveKitDelegate: AnyObject {
    func driveKitDidConnect(_ driveKit: DriveKit)
    func driveKitDidDisconnect(_ driveKit: DriveKit)
    func driveKit(_ driveKit: DriveKit, didReceiveAuthenticationError error: RequestError)
    func userIdUpdateStatusChanged(status: UpdateUserIdStatus, userId: String?)
    func driveKit(_ driveKit: DriveKit, accountDeletionCompleted status: DeleteAccountStatus)
}
```

| Method                                                                              | Description                                                                             |
| ----------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| `driveKitDidConnect(_ driveKit: DriveKit)`                                          | The user has been successfully logged                                                   |
| `driveKitDidDisconnect(_ driveKit: DriveKit)`                                       | The user has been disconnected (manual logout or the account is disabled/deleted)       |
| `driveKit(_ driveKit: DriveKit, didReceiveAuthenticationError error: RequestError)` | The login has failed due to a `RequestError`                                            |
| `userIdUpdateStatusChanged(status: UpdateUserIdStatus, userId: String?)`            | The update userId request has been processed with a `UpdateUserIdStatus` state value    |
| `onAccountDeleted(status: DeleteAccountStatus)`                                     | The delete account request has been processed with a `DeleteAccountStatus` state value. |

## UpdateUserIdStatus

`UpdateUserIdStatus` is an enum that explains the request status after a userId has asked to be changed.

```swift
public enum UpdateUserIdStatus: Int {
    case updated
    case failedToUpdate
    case invalidUserId
    case alreadyUsed
    case savedForRepost
}
```

| Value            | Description                                                                                |
| ---------------- | ------------------------------------------------------------------------------------------ |
| `updated`        | The userId has been successfully updated                                                   |
| `failedToUpdate` | Occurs when DriveKit is not configured yet or if the new userId is the same as the old one |
| `invalidUserId`  | Error returned when the new userId is blank                                                |
| `alreadyUsed`    | The new userId is already taken by another user                                            |
| `savedForRepost` | The request failed but a retry will be done                                                |

## RequestError <a href="#deviceconfigevent" id="deviceconfigevent"></a>

`RequestError` is an enum that describes the error type of a DriveKit request.

```swift
public enum RequestError: Int {
    case noNetwork
    case unauthenticated
    case forbidden
    case serverError
    case clientError
    case limitReached
    case unknownError
}
```

| Value             | Description                                                                                                          |
| ----------------- | -------------------------------------------------------------------------------------------------------------------- |
| `noNetwork`       | The user has no connection or a bad one during the request.                                                          |
| `unauthenticated` | A request has been launched but the user is not logged (401 error).                                                  |
| `forbidden`       | A 403 error occurred. You might don't have access to call that service. Please contact the DriveQuant to learn more. |
| `serverError`     | Drivequant's backend responds with a 500 server error.                                                               |
| `clientError`     | Drivequant's backend responds with a 400 error different than `unauthenticated`, `forbidden` and `limitReached`      |
| `unknownError`    | An unknown error occurred, please contact the Drivequant team to investigate the issue.                              |
| `limitReached`    | The DriveKit API key has reached the accounts number limit. Please contact the Drivequant team.                      |

## DeleteAccountStatus

`DeleteAccountStatus` is an enum that describes the deletion status. It can have 3 values:&#x20;

* `success`: Account deleted successfully&#x20;
* `failedToDelete`: Account not deleted, an error has occurred&#x20;
* `forbidden`: Account deletion not activated for this team

## DKWeather

`DKWeather` is an enum that describe each category of weather during a trip. It can have these values:

* `unknown`
* `sun`
* `cloud`
* `fog`
* `rain`
* `snow`
* `ice`

## DKPeriod

`DKPeriod` indicates the aggregation size of each timeline object. It is an enum with the following values:

<table><thead><tr><th width="247">Value</th><th>Description</th></tr></thead><tbody><tr><td>week</td><td>Timeline data is aggregated week by week</td></tr><tr><td>month</td><td>Timeline data is aggregated month by month</td></tr><tr><td>year</td><td>Timeline data is aggregated year by year</td></tr></tbody></table>

## DKRoadContext

`DKRoadContext` indicates the kind of roads where the data was gathered. It is an enum with the following values:

| Value             | Description                                              |
| ----------------- | -------------------------------------------------------- |
| trafficJam        | The targeted driver was in traffic jams                  |
| heavyUrbanTraffic | The targeted driver was in dense city roads              |
| city              | The targeted driver was in light traffic city roads      |
| suburban          | The targeted driver was in suburban or countryside roads |
| expressways       | The targeted driver was in express ways                  |
