#!/bin/bash ADMIN=$(jq -r .admin config/local.json) if [[ "${ADMIN}" == "" ]]; then echo "You need to set your { 'admin': 'secret' } in config/local.json" exit 1 fi id=$1 give=$2 if [[ "${id}" == "" ]] || [[ "${give}" == "" ]]; then echo "Usage: give GAME-ID (wheat|wood|stone|brick|sheep)-COUNT" exit 1 fi curl --noproxy '*' -s -L \ --request PUT \ --header "PRIVATE-TOKEN: ${ADMIN}" \ --header "Content-Type: application/json" \ http://localhost:8930/ketr.ketran/api/v1/games/${id}/give/${give} | jq -r .status