# Entitlement Definitions

Entitlement definitions describe particular entitlements. They specify whether an entitlement is Boolean or numeric and whether a numeric entitlement is expendable or not.

## Common Entitlements Definition Types

```graphql
type EntitlementDefinition
  name: String!
  description: String
  type: String!
  expendable: Boolean!
}
```

## Listing Entitlement Definitions

Call the `listEntitlementDefinitions` query to list all of the entitlement definitions in the system. This list will vary depending on the Sudo Platform service enabled in your environment.

The results list is paginated with a default page size of 10. To retrieve all results your application must implement the following algorithm.

```
1. Call listEntitlementDefinitions query with nextToken set to null
2. If nextToken in the returned EntitlementDefinitionsConnection is null, 
   there are no more results to retrieve
3. Call listEntitlementDefinitions query with nextToken set to the value
   returned from the previous call
4. Go to step 2
```

```graphql
# Pagination connection for use when listing entitlement definitions
type EntitlementDefinitionConnection {
  items: [EntitlementsDefinition!]!
  nextToken: String
}

# Input for the listEntitlementDefinitions query
input ListEntitlementDefinitionsInput {
  token: String!
}

type Query {
# Retrieves all entitlement definitions.
listEntitlementDefinitions(
  nextToken: String
): EntitlementDefinitionConnection!
}
```

### Possible Errors

* **ServiceError** will be returned for internal errors.

Listing entitlement definitions using SDK.

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

```swift
do {
    let listOutput = try await client.listEntitlementDefinitionsWithNextToken(
        limit: 50,
        nextToken: nil,
    ) 
} catch {
    // Handle error. An error may be thrown if the backend is unable perform
    // the operation due to invalid input, availability or security issues.
}
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
val listOutput =
    client.listEntitlementDefinitions(
        50,
        null 
    )
```

{% endtab %}

{% tab title="TypeScript" %}

```typescript
const limit = 50
let nextToken: string|undefined
const listOutput = await client.listEntitlementDefinitions(
  limit,
  nextToken
)

```

{% endtab %}
{% endtabs %}
