# shellcheck shell=dash disable=SC3043,SC2154
# https://docs.github.com/en/rest/releases/assets#list-release-assets
___x_cmd_gh_repo_release_attachment_ls() {
    param:scope     ___x_cmd_github
    param:dsl    '
options:
    --repo|-r       "<owner_path>/<repo_path>"                                          <>:RepoName
    --release_id    "Release ID"                                                        <>:Number

    --per_page      "Results per page"                                                  <>="30"
    --page          "Page number of the results to fetch."                              <>="1"

    --json|-j   "output origin json data"
    --csv       "output csv data"
    --yml       "output yml data"
'
    param:run

    ___x_cmd_gh_param_init_owner_repo
    [ -n "$owner_repo" ] || M='Please provide --repo <owner/repo>"' arg:ret:64
    if ___x_cmd_gx_output_is_format; then
        ___x_cmd_gh_get_multi "/repos/${owner_repo}/releases/${release_id##*/}/assets" | ___x_cmd_gx_output_format
    else
        ___x_cmd_gh_get_multi "/repos/${owner_repo}/releases/${release_id##*/}/assets" | \
            x jo 2c             .id  .name  .state  .label  .download_count  .size  .updated_at  | \
            x csv header --add   ID   Name   State   Label   Download_Count   Size   Updated_At  | \
            if [ -n "$csv" ]; then  ___x_cmd_cmds cat
            else                    x csv static_tab
            fi
    fi
}
