# -*- coding: utf-8 -*-
"""RTM 相关 API.

auto generated by script at 2017-08-24 21:50:13.459796. don't edit it.

"""
from typing import Any

from attr import NOTHING

from aiobearychat.abc import API
from aiobearychat.sansio import Response, clean_nothing_keys


class RtmAPI(API):
    """RTM 相关 API."""

    async def start(self,
                    **requester_params: Any) -> Response:
        """打开 RTM 连接会话.

        官方文档地址：https://github.com/bearyinnovative/OpenAPI/blob/master/api/rtm.start.md



        :return: response. 一个 :class:`aiobearychat.sansio.Response` 实例
        :rtype: :class:`aiobearychat.sansio.Response`

        ``response.body`` 返回值示例::

            response.status 等于 200 时:

                {
                  "ws_host": "wss://rtm.bearychat.com/nimbus/ws:xxx",
                  "user": {
                    "inactive": false,
                    "role": "normal",
                    "email": "support@bearyinnovative.com",
                    "name": "BearyBot",
                    "type": "assistant",
                    "created": "2017-01-11T12:28:31.000+0000",
                    "id": "=bwMkR",
                    "avatars": {
                      "small": null,
                      "medium": null,
                      "large": null
                    },
                    "team_id": "=bw52O",
                    "full_name": "倍洽小助手",
                    "mobile": null,
                    "profile": {
                      "bio": null,
                      "position": null,
                      "skype": null
                    }
                  }
                }

        """
        url_params = {}
        body_params = {}
        body_params['token'] = self._token
        body_params.update({
        })
        url = self.base_url + '/rtm.start'
        headers = {
            'content-type': 'application/json',
        }

        url_params = clean_nothing_keys(url_params)
        body_params = clean_nothing_keys(body_params)

        return await self._make_request('post',
                                        url,
                                        url_params=url_params,
                                        body_params=body_params,
                                        headers=headers,
                                        **requester_params)
