"""Example: WeChat-Channels-API

SDK attribute: ``client.wechat_channels``
Endpoints: 10

Usage::

    python examples/wechat_channels.py

AUTO-GENERATED by scripts/generate_examples.py.
"""

import asyncio
import json

from tikhub import AsyncTikHub

API_KEY = "YOUR_API_KEY"


async def main():
    async with AsyncTikHub(api_key=API_KEY) as client:

        # POST /api/v1/wechat_channels/fetch_default_search
        # 微信视频号默认搜索/WeChat Channels Default Search
        result = await client.wechat_channels.fetch_default_search(keywords='美食', session_buffer='')
        print(json.dumps(result, indent=2, ensure_ascii=False))

        # GET /api/v1/wechat_channels/fetch_search_latest
        # 微信视频号搜索最新视频/WeChat Channels Search Latest Videos
        result = await client.wechat_channels.fetch_search_latest(keywords='美食')
        print(json.dumps(result, indent=2, ensure_ascii=False))

        # GET /api/v1/wechat_channels/fetch_search_ordinary
        # 微信视频号综合搜索/WeChat Channels Comprehensive Search
        result = await client.wechat_channels.fetch_search_ordinary(keywords='美食')
        print(json.dumps(result, indent=2, ensure_ascii=False))

        # GET /api/v1/wechat_channels/fetch_user_search
        # 微信视频号用户搜索/WeChat Channels User Search
        result = await client.wechat_channels.fetch_user_search(keywords='美食博主', page=1)
        print(json.dumps(result, indent=2, ensure_ascii=False))

        # GET /api/v1/wechat_channels/fetch_user_search_v2
        # 微信视频号用户搜索V2/WeChat Channels User Search V2
        result = await client.wechat_channels.fetch_user_search_v2(keywords='美食博主', page=0)
        print(json.dumps(result, indent=2, ensure_ascii=False))

        # GET /api/v1/wechat_channels/fetch_video_detail
        # 微信视频号视频详情/WeChat Channels Video Detail
        result = await client.wechat_channels.fetch_video_detail(id='14396973035218999573', exportId='')
        print(json.dumps(result, indent=2, ensure_ascii=False))

        # POST /api/v1/wechat_channels/fetch_home_page
        # 微信视频号主页/WeChat Channels Home Page
        result = await client.wechat_channels.fetch_home_page(username='v2_060000231003b20faec8c4ea8a1ac7d5c80ce434b077535b622489f476b63209b6886fc4a16f@finder', last_buffer='')
        print(json.dumps(result, indent=2, ensure_ascii=False))

        # POST /api/v1/wechat_channels/fetch_comments
        # 微信视频号评论/WeChat Channels Comments
        result = await client.wechat_channels.fetch_comments(id='14145780330774202411', lastBuffer='')
        print(json.dumps(result, indent=2, ensure_ascii=False))

        # GET /api/v1/wechat_channels/fetch_live_history
        # 微信视频号直播回放/WeChat Channels Live History
        result = await client.wechat_channels.fetch_live_history(username='v2_060000231003b20faec8c5eb811dc1d2cc0cee34b0779397527ceff87326eefb309aac785aa8@finder')
        print(json.dumps(result, indent=2, ensure_ascii=False))

        # GET /api/v1/wechat_channels/fetch_hot_words
        # 微信视频号热门话题/WeChat Channels Hot Topics
        result = await client.wechat_channels.fetch_hot_words()
        print(json.dumps(result, indent=2, ensure_ascii=False))


if __name__ == "__main__":
    asyncio.run(main())