> For the complete documentation index, see [llms.txt](https://biot-ws.gitbook.io/biot-core/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://biot-ws.gitbook.io/biot-core/channels/api.md).

# API

## approve

Calling at start of the channel and approving it

{% tabs %}
{% tab title="JS modules" %}

```javascript
await channel.approve();
```

{% endtab %}

{% tab title="WS" %}

```javascript
socket.send(JSON.stringify({
    id: i++,
    name: 'channel',
    args: [channelId, 'approve']
}));
```

{% endtab %}
{% endtabs %}

## reject

Calling at start of the channel and reject it

{% tabs %}
{% tab title="JS modules" %}

```javascript
await channel.reject();
```

{% endtab %}

{% tab title="WS" %}

```javascript
socket.send(JSON.stringify({
    id: i++,
    name: 'channel',
    args: [channelId, 'reject']
}));
```

{% endtab %}
{% endtabs %}

## transfer

Transfer moneys inside of the channel to the second side.

**Params:**

&#x20;amount - **{number}** - How much money we transfer?

&#x20;message - **{string|object}** - Transfer message

{% tabs %}
{% tab title="JS modules" %}

```javascript
await channel.transfer(100, 'hello!');
```

{% endtab %}

{% tab title="WS" %}

```javascript
socket.send(JSON.stringify({
    id: i++,
    name: 'channel',
    args: [channelId, 'transfer', 100, 'hello!']
}));
```

{% endtab %}
{% endtabs %}

## closeMutually

Mutually closing the channel

{% tabs %}
{% tab title="JS modules" %}

```javascript
await channel.closeMutually();
```

{% endtab %}

{% tab title="WS" %}

```javascript
socket.send(JSON.stringify({
    id: i++,
    name: 'channel',
    args: [channelId, 'closeMutually']
}));
```

{% endtab %}
{% endtabs %}

## closeOneSide

Onesided closing of the channel

{% tabs %}
{% tab title="JS modules" %}

```javascript
await channel.closeOneSide();
```

{% endtab %}

{% tab title="WS" %}

```javascript
socket.send(JSON.stringify({
    id: i++,
    name: 'channel',
    args: [channelId, 'closeOneSide']
}));
```

{% endtab %}
{% endtabs %}
