# -*- coding: utf-8 -*-
"""用户相关 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 UserAPI(API):
    """用户相关 API."""

    async def info(self,
                   user_id: str,
                   **requester_params: Any) -> Response:
        """返回团队内指定用户完整信息。

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



        :param user_id: 指定用户 id (示例: ``=bw52O``)
        :type user_id: :class:`str`


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

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

            response.status 等于 200 时:

                {
                  "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 = {}
        url_params['token'] = self._token

        url_params.update({
            'user_id': user_id,
        })

        url = self.base_url + '/user.info'
        headers = {
            'content-type': 'application/json',
        }

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

        body_params = None

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

    async def list(self,
                   **requester_params: Any) -> Response:
        """返回团队内的用户列表，获取某个用户的完整信息，请使用 ``user.info``.

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



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

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

            response.status 等于 200 时:

                [
                  {
                    "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 = {}
        url_params['token'] = self._token

        url_params.update({
        })

        url = self.base_url + '/user.list'
        headers = {
            'content-type': 'application/json',
        }

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

        body_params = None

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

    async def me(self,
                 **requester_params: Any) -> Response:
        """返回当前用户的信息。

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



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

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

            response.status 等于 200 时:

                {
                  "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 = {}
        url_params['token'] = self._token

        url_params.update({
        })

        url = self.base_url + '/user.me'
        headers = {
            'content-type': 'application/json',
        }

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

        body_params = None

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

    async def update_me(self,
                        *,
                        name: str = NOTHING,
                        full_name: str = NOTHING,
                        **requester_params: Any) -> Response:
        """更新当前用户信息。

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



        :param name: 用户名 (@name) (示例: ``beary_bot``)
        :type name: :class:`str`


        :param full_name: 用户全名 (示例: ``BearyBot``)
        :type full_name: :class:`str`


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

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

            response.status 等于 200 时:

                {
                  "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({
            'name': name,
            'full_name': full_name,
        })
        url = self.base_url + '/user.update_me'
        headers = {
            'content-type': 'application/json',
        }

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

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