# InfoboardChannels

`InfoboardChannels` function as subspaces within the Infoboard. Access to each `InfoboardChannel` is controlled through [EntityPermissions](https://docs.api.intratool.de/api-reference/entity-permissions), which define the [Departments](https://docs.api.intratool.de/api-reference/departments) that are members of the channel.

An [InfoboardPost](https://docs.api.intratool.de/api-reference/infoboard/infoboard-posts) can be assigned an `infoboard_channel_id`, making it visible only to the [Departments](https://docs.api.intratool.de/api-reference/departments) granted access via [EntityPermissions](https://docs.api.intratool.de/api-reference/entity-permissions). Additionally, [InfoboardPosts](https://docs.api.intratool.de/api-reference/infoboard/infoboard-posts) in channels can further restrict access to individual [Departments](https://docs.api.intratool.de/api-reference/departments) within the channel via the `departments` relation.

It is also possible to assign permissions such as `write`, `comment` and `administrate` for the individual [Roles](https://docs.api.intratool.de/api-reference/roles) of the assigned [Departments](https://docs.api.intratool.de/api-reference/departments) via [EntityPermissions](https://docs.api.intratool.de/api-reference/entity-permissions).

## Model Definition

### Alias

`infoboardChannel`

### Relations

| Key                 | Relation                                                                               | Type       | Relation Field(s)                     |
| ------------------- | -------------------------------------------------------------------------------------- | ---------- | ------------------------------------- |
| `user`              | [User](https://docs.api.intratool.de/api-reference/users)                              | Belongs to | `user_id`                             |
| `folder`            | [Folder](https://docs.api.intratool.de/api-reference/folders)                          | Belongs to | `folder_id`                           |
| `icon`              | [Icon](https://docs.api.intratool.de/api-reference/icons)                              | Belongs to | `icon_id`                             |
| `entityPermissions` | [EntityPermissions](https://docs.api.intratool.de/api-reference/entity-permissions)    | Morph many |                                       |
| `infoboardPosts`    | [InfoboardPost](https://docs.api.intratool.de/api-reference/infoboard/infoboard-posts) | Has many   | `infoboard_post.infoboard_channel_id` |

## List

Get a list of all `InfoboardChannels` the current authenticated [User](https://docs.api.intratool.de/api-reference/users) is allowed to view.

**Definition**

<mark style="color:green;">`GET`</mark> `/api/infoboard/channels`

**Example Request**

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

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/infoboard/channels', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);
```

{% endtab %}
{% endtabs %}

**Example Response Body**

```json
[
  {
    "id": 1,
    "user_id": 1,
    "folder_id": null,
    "icon_id": 10,
    "title": "Non curabitur gravida arcu ac",
    "color": "#ffffff",
    "sort_number": 1,
    "created_at": "2025-03-17 12:00:00",
    "updated_at": "2025-03-17 12:00:00",
    "deleted_at": null
  },
  {
    "id": 2,
    "user_id": 1,
    "folder_id": null,
    "icon_id": 20,
    "title": "Placerat duis ultricies lacus sed",
    "color": "#000000",
    "sort_number": 2,
    "created_at": "2025-03-17 13:00:00",
    "updated_at": "2025-03-17 13:00:00",
    "deleted_at": null
  }
]
```

## Show

Show a single `InfoboardChannel` by `id`.

**Definition**

<mark style="color:green;">`GET`</mark> `/api/infoboard/channels/{``id}`

**Example Request**

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

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/infoboard/channels/1', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "id": 1,
  "user_id": 1,
  "folder_id": null,
  "icon_id": 10,
  "title": "Non curabitur gravida arcu ac",
  "color": "#ffffff",
  "sort_number": 1,
  "created_at": "2025-03-17 12:00:00",
  "updated_at": "2025-03-17 12:00:00",
  "deleted_at": null
}
```

## \[Adm.] List

Get a list of all `InfoboardChannels`.

**Definition**

<mark style="color:green;">`GET`</mark> /api/administration/infoboard/channels\`

**Example Request**

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

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/administration/infoboard/channels', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);
```

**Example Response Body**

```json
[
  {
    "id": 1,
    "user_id": 1,
    "folder_id": null,
    "icon_id": 10,
    "title": "Non curabitur gravida arcu ac",
    "color": "#ffffff",
    "sort_number": 1,
    "created_at": "2025-03-17 12:00:00",
    "updated_at": "2025-03-17 12:00:00",
    "deleted_at": null
  },
  {
    "id": 2,
    "user_id": 1,
    "folder_id": null,
    "icon_id": 20,
    "title": "Placerat duis ultricies lacus sed",
    "color": "#000000",
    "sort_number": 2,
    "created_at": "2025-03-17 13:00:00",
    "updated_at": "2025-03-17 13:00:00",
    "deleted_at": null
  }
]
```

## \[Adm.] Show

Get a single `InfoboardChannel` by `id`.

**Definition**

<mark style="color:green;">`GET`</mark> /api/administration/infoboard/channels/{id}\`

**Example Request**

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

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/administration/infoboard/channels/1', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);
```

**Example Response Body**

```json
{
  "id": 1,
  "user_id": 1,
  "folder_id": null,
  "icon_id": 10,
  "title": "Non curabitur gravida arcu ac",
  "color": "#ffffff",
  "sort_number": 1,
  "created_at": "2025-03-17 12:00:00",
  "updated_at": "2025-03-17 12:00:00",
  "deleted_at": null
}
```

## \[Adm.] Create

Create a new `InfoboardChannel`.

**Definition**

<mark style="color:yellow;">`POST`</mark> `/api/administration/infoboard/channels`

**Request Keys**

| Key           | Type    | Default            | Description                                                                                                       |
| ------------- | ------- | ------------------ | ----------------------------------------------------------------------------------------------------------------- |
| `folder_id`   | integer | -                  | The ID of [Folder](https://docs.api.intratool.de/api-reference/folders) the `InfoboardChannel` is assigned to.    |
| `icon_id`     | integer | -                  | The ID of the [Icon](https://docs.api.intratool.de/api-reference/icons) or the `InfoboardChannel`                 |
| `title`\*     | string  | -                  | The title of the `InfoboardChannel`.                                                                              |
| `color`       | string  | -                  | The color as a HEX string.                                                                                        |
| `sort_number` | integer | Current highest +1 | The index of the `InfoboardChannel` related to the [Folder](https://docs.api.intratool.de/api-reference/folders). |

Keys with `*` are required.

**Example Request**

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

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('POST', '/api/administration/infoboard/channels', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'icon_id' => 30,
        'title' => 'Sagittis purus sit amet volutpat',
        'color' => '#cccccc'
    ]
]);
```

{% endtab %}
{% endtabs %}

**Example Response Body**

```json
{
  "status": "success",
  "data": {
    "id": 3,
    "user_id": 1,
    "folder_id": null,
    "icon_id": 30,
    "title": "Sagittis purus sit amet volutpat",
    "color": "#cccccc",
    "sort_number": 3,
    "created_at": "2025-03-17 14:00:00",
    "updated_at": "2025-03-17 14:00:00",
    "deleted_at": null
  }
}
```

## \[Adm.] Update

Update an existing `InfoboardChannel` by `id`.

**Definition**

<mark style="color:blue;">`PUT`</mark> `/api/administration/infoboard/channels/{id}`

**Request Keys**

| Key           | Type    | Description                                                                                                       |
| ------------- | ------- | ----------------------------------------------------------------------------------------------------------------- |
| `folder_id`   | integer | The ID of [Folder](https://docs.api.intratool.de/api-reference/folders) the `InfoboardChannel` is assigned to.    |
| `icon_id`     | integer | The ID of the [Icon](https://docs.api.intratool.de/api-reference/icons) or the `InfoboardChannel`                 |
| `title`       | string  | The title of the `InfoboardChannel`.                                                                              |
| `color`       | string  | The color as a HEX string.                                                                                        |
| `sort_number` | integer | The index of the `InfoboardChannel` related to the [Folder](https://docs.api.intratool.de/api-reference/folders). |

**Example Request**

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

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('PUT', '/api/administration/infoboard/channels/3', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'icon_id' => 40,
        'color' => '#dddddd'
    ]
]);
```

{% endtab %}
{% endtabs %}

**Example Response Body**

```json
{
  "status": "success",
  "data": {
    "id": 3,
    "user_id": 1,
    "folder_id": null,
    "icon_id": 40,
    "title": "Sagittis purus sit amet volutpat",
    "color": "#dddddd",
    "sort_number": 3,
    "created_at": "2025-03-17 14:00:00",
    "updated_at": "2025-03-17 15:00:00",
    "deleted_at": null
  }
}
```

## \[Adm.] Delete

Delete an existing `InfoboardChannel` by `id`.

**Definition**

<mark style="color:red;">`DELETE`</mark> `/api/administration/infoboard/channels/{id}`

**Example Request**

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

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('DELETE', '/api/administration/infoboard/channels/3', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);
```

{% endtab %}
{% endtabs %}

**Example Response Body**

```json
{
  "status": "success",
  "data": null
}
```
