# shellcheck shell=dash

___x_cmd_feishu_abot_info(){
    param:void

    local appid=""
    local lang="zh_cn"
    local id_type="open_id"
    while [ $# -gt 0 ]; do
        case "$1" in
            -h|--help)              ___x_cmd help -m feishu abot info ; return 0 ;;
            --appid)                appid="$2" ;        arg:2:shift ;;
            --lang)                 lang="$2" ;         arg:2:shift ;;
            --id_type)              id_type="$2" ;      arg:2:shift ;;
            *)                      appid="$1"; shift ;;
        esac
    done

    [ -n "$appid" ] || appid="me"

    ___x_cmd_feishu_appinfo___ "$appid" "$lang" "$id_type"
}

___x_cmd_feishu_appinfo___(){
    local appid="$1"
    local lang="$2"
    local id_type="$3"

    local x_=; local cur_token
    ____x_cmd_tenant_token ; cur_token="$x_"

    ___x_cmd curl -s -X GET "https://open.feishu.cn/open-apis/application/v6/applications/${appid}?lang=${lang}&id_type=${id_type}" \
    -H "Authorization: Bearer $cur_token"
}
