# shellcheck shell=bash

___X_CMD_SHODAN_API_URL="https://api.shodan.io"
___x_cmd_shodan_api(){
    local op="$1";
    local url=$2;
    shift 2
    local param="$1"
    local _curl_url="$___X_CMD_SHODAN_API_URL"

    case "${op}" in
        get|get_|del)
            ___x_cmd_shodan_api_"$op" "\"${_curl_url}${url}\"" "$*"
            ;;
        post|put)
            ___x_cmd_shodan_api_"$op" "\"${_curl_url}${url}\" ${param}"
            ;;
    esac
}

___x_cmd_shodan_api_get_(){
    shodan:debug "x curl -s -X GET $*"
    x_="$(eval x curl -s -X GET "$*")"
    # x_="$(eval x curl --rate 1/s -s -X GET "$*")"
}


___x_cmd_shodan_api_get(){
    shodan:debug "x curl -s -X GET $*"
    # eval "x curl --rate 1/s -s -X GET $*"
    eval "x curl -s -X GET $*"
}

___x_cmd_shodan_api_post(){
    shodan:debug "x curl -s -X POST $*"
    # eval "x curl --rate 1/s -s -X POST $*"
    eval "x curl -s -X POST $*"
}

___x_cmd_shodan_api_put(){
    shodan:debug "x curl -s -X PUT $*"
    # eval "x curl --rate 1/s -s -X PUT $*"
    eval "x curl -s -X PUT $*"
}

___x_cmd_shodan_api_del(){
    shodan:debug "x curl -s -X DELETE $*"
    # eval "x curl --rate 1/s -s -X DELETE $*"
    eval "x curl -s -X DELETE $*"
}


