> For the complete documentation index, see [llms.txt](https://teamleader-sdk.mcore-services.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://teamleader-sdk.mcore-services.dev/api-reference/general/work-types.md).

# Work Types

Manage work types in Teamleader Focus.

```php
Teamleader::workTypes()
```

|                          |                                                                       |
| ------------------------ | --------------------------------------------------------------------- |
| Class                    | `McoreServices\TeamleaderSDK\Resources\General\WorkTypes`             |
| Create / update / delete | — / — / —                                                             |
| Pagination               | `page_size` / `page_number`; no totals — a short page is the last one |

## Endpoints

* `workTypes.list`

## Filters

Passed as the first argument to `list()`. Any other key throws.

| Filter | Description                                       |
| ------ | ------------------------------------------------- |
| `ids`  | Array of work type UUIDs to filter by             |
| `term` | Search term - searches in the work type name only |

## Methods

### `search()`

```php
search(string $term): array
```

Search work types by term

* `$term` — Search term

### `list()`

```php
list(array $filters = [], array $options = []): array
```

List work types

* `$filters` — ids, term
* `$options` — page\_size, page\_number (no sort — see sortedByName())

**Throws** `InvalidArgumentException` On an unknown filter key or option

### `byIds()`

```php
byIds(array $ids): array
```

Get work types by specific IDs

* `$ids` — Array of work type UUIDs

### `paginate()`

```php
paginate(int $pageSize = 20, int $pageNumber = 1, array $filters = []): array
```

Get work types with pagination

* `$pageSize` — Number of items per page
* `$pageNumber` — Page number
* `$filters` — Optional filters

### `sortedByName()`

```php
sortedByName(string $order = 'asc', array $filters = []): array
```

Get work types sorted by name

* `$order` — Sort order (asc or desc)
* `$filters` — Optional filters

### `info()`

```php
info($id, $includes = null): array
```

Work types don't support info method as per API docs, but we keep it for consistency and throw a helpful exception

* `$id` — Work type UUID
* `$includes` — Includes (not used)

**Throws** `InvalidArgumentException`

## Examples

Get all work types:

```php
$workTypes = Teamleader::workTypes()->list();
```

Search work types by name:

```php
$workTypes = Teamleader::workTypes()->list(['term' => 'design']);
```

Get specific work types by ID:

```php
$workTypes = Teamleader::workTypes()->list(['ids' => ['uuid1', 'uuid2']]);
```

Get work types sorted by name:

```php
$workTypes = Teamleader::workTypes()->sortedByName();
```

Get work types with pagination:

```php
$workTypes = Teamleader::workTypes()->list([], ['page_size' => 50, 'page_number' => 2]);
```
