# スポットライト API


## FocusSpotlightFixed

**x-sora-target**: Sora_20200807.FocusSpotlightFixed

指定した Connection ID のクライアントに常にフォーカスが当たるようにします。
UnfocusSpotlight API が呼ばれるまでフォーカスが当たり続けます。

* - キー
  - 型
* - channel_id
  - string
* - connection_id
  - string


```
$ http POST 127.0.0.1:3000/ x-sora-target:Sora_20200807.FocusSpotlightFixed \
    channel_id=sora connection_id=7QSNT842FS0J9E6BZDBC2DRYY8 -vvv
POST / HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 69
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/2.0.0
x-sora-target: Sora_20200807.FocusSpotlightFixed

{
    "channel_id": "sora",
    "connection_id": "7QSNT842FS0J9E6BZDBC2DRYY8"
}

HTTP/1.1 200 OK
access-control-allow-headers: Origin, X-Requested-With, Content-Type, Accept, x-sora-target
access-control-allow-methods: POST, OPTIONS
access-control-allow-origin: http://127.0.0.1:5000
access-control-max-age: 1000
content-length: 66
content-type: application/json
date: Wed, 09 Sep 2020 08:27:57 GMT
server: Cowboy

{
    "channel_id": "sora",
    "connection_id": "7QSNT842FS0J9E6BZDBC2DRYY8"
}
```


## FocusSpotlight

**x-sora-target**: Sora_20200807.FocusSpotlight

指定した Connection ID のクライアントに強制的にフォーカスを当てます。

* - キー
  - 型
* - channel_id
  - string
* - connection_id
  - string


```
$ http POST 127.0.0.1:3000/ x-sora-target:Sora_20200807.FocusSpotlight \
    channel_id=sora connection_id=74Z2G1JS7S67DE226T8R1H3YGW -vvv
POST / HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 69
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/2.0.0
x-sora-target: Sora_20200807.FocusSpotlight

{
    "channel_id": "sora",
    "connection_id": "74Z2G1JS7S67DE226T8R1H3YGW"
}

HTTP/1.1 200 OK
access-control-allow-headers: Origin, X-Requested-With, Content-Type, Accept, x-sora-target
access-control-allow-methods: POST, OPTIONS
access-control-allow-origin: http://127.0.0.1:5000
access-control-max-age: 1000
content-length: 66
content-type: application/json
date: Wed, 09 Sep 2020 08:33:54 GMT
server: Cowboy

{
    "channel_id": "sora",
    "connection_id": "74Z2G1JS7S67DE226T8R1H3YGW"
}
```


## UnfocusSpotlight

**x-sora-target**: Sora_20200807.UnfocusSpotlight

指定した Connection ID のフォーカスを外します。

この API は FocusSpotlightFixed でフォーカスを当て続けている状態を解除する場合にも利用します。

* - キー
  - 型
* - channel_id
  - string
* - connection_id
  - string


```
$ http POST 127.0.0.1:3000/ x-sora-target:Sora_20200807.UnfocusSpotlight \
    channel_id=sora connection_id=74Z2G1JS7S67DE226T8R1H3YGW -vvv
POST / HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 69
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/2.0.0
x-sora-target: Sora_20200807.UnfocusSpotlight

{
    "channel_id": "sora",
    "connection_id": "74Z2G1JS7S67DE226T8R1H3YGW"
}

HTTP/1.1 200 OK
access-control-allow-headers: Origin, X-Requested-With, Content-Type, Accept, x-sora-target
access-control-allow-methods: POST, OPTIONS
access-control-allow-origin: http://127.0.0.1:5000
access-control-max-age: 1000
content-length: 66
content-type: application/json
date: Wed, 09 Sep 2020 08:34:56 GMT
server: Cowboy

{
    "channel_id": "sora",
    "connection_id": "74Z2G1JS7S67DE226T8R1H3YGW"
}
```


## ChangeSpotlightNumber

**x-sora-target**: Sora_20200807.ChangeSpotlightNumber

フォーカスする最大数を変更します。最小は 1 で最大は 8 です。

この API でフォーカス最大数を変更した後に、 `type:connect` で
`spotlight_number` を指定するクライアントは、 **変更後の値** を指定する必要があります。

* - キー
  - 型
* - channel_id
  - string
* - spotlight_number
  - integer (1..8)


```
$ http POST 127.0.0.1:3000/ x-sora-target:Sora_20200807.ChangeSpotlightNumber \
    channel_id=sora spotlight_number:=1 -vvv
POST / HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 45
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/2.0.0
x-sora-target: Sora_20200807.ChangeSpotlightNumber

{
    "channel_id": "sora",
    "spotlight_number": 1
}

HTTP/1.1 200 OK
access-control-allow-headers: Origin, X-Requested-With, Content-Type, Accept, x-sora-target
access-control-allow-methods: POST, OPTIONS
access-control-allow-origin: http://127.0.0.1:5000
access-control-max-age: 1000
content-length: 42
content-type: application/json
date: Wed, 09 Sep 2020 08:35:36 GMT
server: Cowboy

{
    "channel_id": "sora",
    "spotlight_number": 1
}
```


## RequestSpotlightRid

**x-sora-target**: Sora_20211215.RequestSpotlightRid

スポットライトのフォーカス時とアンフォーカス時の rid を指定します。
これにより接続時に指定した `spotlight_focus_rid` と `spotlight_unfocus_rid` の値を変更できます。

* - キー
  - 型
* - channel_id
  - string
* - recv_connection_id
  - string
* - send_connection_id (オプション)
  - string
* - spotlight_focus_rid
  - string (none | r0 | r1 | r2)
* - spotlight_unfocus_rid
  - string (none | r0 | r1 | r2)


```
$ http POST 127.0.0.1:3000/ x-sora-target:Sora_20211215.RequestSpotlightRid \
    channel_id=sora \
    recv_connection_id=AD0ZWY8W492XV9RQGB40GX5C94 \
    spotlight_focus_rid=none \
    spotlight_unfocus_rid=none \
    -vvv
POST / HTTP/1.1
Accept: application/json, */*;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 138
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/2.4.0
x-sora-target: Sora_20211215.RequestSpotlightRid

{
    "channel_id": "sora",
    "recv_connection_id": "AD0ZWY8W492XV9RQGB40GX5C94",
    "spotlight_focus_rid": "none",
    "spotlight_unfocus_rid": "none"
}


HTTP/1.1 200 OK
access-control-allow-headers: Origin, X-Requested-With, Content-Type, Accept, x-sora-target
access-control-allow-methods: POST, OPTIONS
access-control-allow-origin: http://127.0.0.1:5000
access-control-max-age: 1000
content-length: 131
content-type: application/json
date: Tue, 30 Nov 2021 02:20:44 GMT
server: Cowboy

{
    "channel_id": "sora",
    "recv_connection_id": "AD0ZWY8W492XV9RQGB40GX5C94",
    "spotlight_focus_rid": "none",
    "spotlight_unfocus_rid": "none"
}
```


## ResetSpotlightRid

**x-sora-target**: Sora_20211215.ResetSpotlightRid

スポットライトのフォーカス時とアンフォーカス時の rid を接続時に指定した値に戻します。

* - キー
  - 型
* - channel_id
  - string
* - recv_connection_id
  - string
* - send_connection_id (オプション)
  - string


```
$ http POST 127.0.0.1:3000/ x-sora-target:Sora_20211215.ResetSpotlightRid \
    channel_id=sora \
    recv_connection_id=AD0ZWY8W492XV9RQGB40GX5C94 \
    -vvv
POST / HTTP/1.1
Accept: application/json, */*;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 74
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/2.4.0
x-sora-target: Sora_20211215.ResetSpotlightRid

{
    "channel_id": "sora",
    "recv_connection_id": "AD0ZWY8W492XV9RQGB40GX5C94"
}


HTTP/1.1 200 OK
access-control-allow-headers: Origin, X-Requested-With, Content-Type, Accept, x-sora-target
access-control-allow-methods: POST, OPTIONS
access-control-allow-origin: http://127.0.0.1:5000
access-control-max-age: 1000
content-length: 71
content-type: application/json
date: Tue, 30 Nov 2021 02:22:17 GMT
server: Cowboy

{
    "channel_id": "sora",
    "recv_connection_id": "AD0ZWY8W492XV9RQGB40GX5C94"
}
```


## BatchRequestSpotlightRid

**x-sora-target**: Sora_20211215.BatchRequestSpotlightRid

スポットライトのフォーカス時とアンフォーカス時の rid を一括で変更します。

* - キー
  - 型
* - channel_id
  - string
* - item_list
  - array

item_list には以下が含まれます。

* - キー
  - 型
* - recv_connection_id
  - string
* - send_connection_id
  - string
* - spotlight_focus_rid
  - string (none | r0 | r1 | r2)
* - spotlight_unfocus_rid
  - string (none | r0 | r1 | r2)


```
$ http POST 127.0.0.1:3000/ x-sora-target:Sora_20211215.BatchRequestSpotlightRid \
    channel_id=sora \
    item_list:='[{"recv_connection_id": "AD0ZWY8W492XV9RQGB40GX5C94", "send_connection_id": "RGEFFZM95S2XN0PC03XNMCRTB0", \
                  "spotlight_focus_rid": "none", "spotlight_unfocus_rid": "none"}, \
                 {"recv_connection_id": "AD0ZWY8W492XV9RQGB40GX5C94", "send_connection_id": "P9AFYE2BQN7JB93Q6GK0VYWGHM", \
                  "spotlight_focus_rid": "none", "spotlight_unfocus_rid": "none"}]' \
    -vvv
POST / HTTP/1.1
Accept: application/json, */*;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 377
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/2.4.0
x-sora-target: Sora_20211215.BatchRequestSpotlightRid

{
    "channel_id": "sora",
    "item_list": [
        {
            "recv_connection_id": "AD0ZWY8W492XV9RQGB40GX5C94",
            "send_connection_id": "RGEFFZM95S2XN0PC03XNMCRTB0",
            "spotlight_focus_rid": "none",
            "spotlight_unfocus_rid": "none"
        },
        {
            "recv_connection_id": "AD0ZWY8W492XV9RQGB40GX5C94",
            "send_connection_id": "P9AFYE2BQN7JB93Q6GK0VYWGHM",
            "spotlight_focus_rid": "none",
            "spotlight_unfocus_rid": "none"
        }
    ]
}


HTTP/1.1 200 OK
access-control-allow-headers: Origin, X-Requested-With, Content-Type, Accept, x-sora-target
access-control-allow-methods: POST, OPTIONS
access-control-allow-origin: http://127.0.0.1:5000
access-control-max-age: 1000
content-length: 387
content-type: application/json
date: Tue, 30 Nov 2021 02:29:51 GMT
server: Cowboy

{
    "channel_id": "sora",
    "item_list": [
        {
            "recv_connection_id": "AD0ZWY8W492XV9RQGB40GX5C94",
            "result": "ok",
            "send_connection_id": "RGEFFZM95S2XN0PC03XNMCRTB0",
            "spotlight_focus_rid": "none",
            "spotlight_unfocus_rid": "none"
        },
        {
            "recv_connection_id": "AD0ZWY8W492XV9RQGB40GX5C94",
            "result": "ok",
            "send_connection_id": "P9AFYE2BQN7JB93Q6GK0VYWGHM",
            "spotlight_focus_rid": "none",
            "spotlight_unfocus_rid": "none"
        }
    ]
}
```
