#!/bin/sh

# wazero run ./url2json.wasm --url 'TODO'

ex1() {
	URL='http://127.0.0.1/api/v1/users'
	echo "URL1: $URL"
	echo "$URL" |
		./url2json |
		jq .
	echo
}

ex2() {
	URL='http://127.0.0.1:8080/api/v1/users?active=false'
	echo "URL2: $URL"
	./url2json --url="$URL" |
		jq .
	echo
}

ex3() {
	URL='https://www.example.com/search?q=rust+lang&sort=desc&page=2'
	echo "URL3: $URL"
	./url2json --url="$URL" |
		jq .
	echo
}

ex4_wazero() {
	URL='https://api.github.com/users/octocat'
	echo "URL4 (wazero): $URL"
	wazero run --timeout=1s ./url2json.wasm -- --url="$URL" |
		jq .
	echo
}

ex1
ex2
ex3
ex4_wazero
