# shellcheck shell=dash disable=SC2154
# https://codeberg.org/api/swagger#/organization/orgListTeamMembers
___x_cmd_fjo_team_member_ls() {
    param:scope     ___x_cmd_fjo
    param:dsl       '
options:
    --team          "<org>/<team> or <team_id>"                     <>
    --limit         "Results per page"                              <>:Numbers="30"
    --page          "Page number of the results to fetch."          <>:Numbers="1"
    --json|-j       "Output json data"
'
    param:run

    [ -n "$team" ] || M='accepts option --team (<org>/<team> or <team_id>), received empty' arg:ret:64
    local _avt_team="$team"
    ___x_cmd is int "$_avt_team" || ___x_cmd_fjo____transform_avt_team "$_avt_team" || return

    if ___x_cmd_gx_output_is_format; then
        ___x_cmd_fjo_get_multi "/teams/${_avt_team}/members" | ___x_cmd_gx_output_format
    else
        ___x_cmd_fjo_get_multi "/teams/${_avt_team}/members" | \
            x jo 2c             .id .username .is_admin  | \
            x csv header --add   ID  Username  Is_admin  | \
            if [ -n "$csv" ]; then  ___x_cmd_cmds cat
            else                    x csv app
            fi
    fi
}
