# Policy

### Fetch policies list

To fetch policies list for logged in user, the following API can be used.

Concrete Example

{% tabs %}
{% tab title="Swift" %}

```swift
let service = PolicyService()

service.fetchPolicies() { result in
    switch result {
    case .success(let policies):
        // fetch successful
    case .failure:
        // API call failed
    }
}
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
val service = PolicyService()

service.fetchPolicies { result ->
    if (result is Result.Success) {
        val policies = result.value // List<Policy>
        // fetch successful
    } else if (result is Result.Failure) {
        // API call failed
        val error = result.throwable
    }
}
```

{% endtab %}
{% endtabs %}

## FetchAssociatedUsers

To fetch the list of users associated for a specific policy, the following API can be used

Concrete Example

{% tabs %}
{% tab title="Swift" %}

```swift
let service = PolicyService()

service.fetchAssociatedUsers(policyId: policyId) { result in
    switch result {
    case .success(let associatedUsers):
        // fetch successful
    case .failure:
        // API call failed
    }
}
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
val service = PolicyService()

service.fetchAssociatedUsers(policyId = policyId) { result ->
    if (result is Result.Success) {
        val associatedUsers = result.value // List<AssociatedUser>
        // fetch successful
    } else if (result is Result.Failure) {
        // API call failed
        val error = result.throwable
    }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sdk.ims.tech/drivesync-portal/policy.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
