#!/bin/bash

git checkout backup-conversation-wsh1

curl --silent --show-error --fail -u $CONVERSATION_USER:$CONVERSATION_PASS "https://gateway.watsonplatform.net/conversation/api/v1/workspaces/$CONVERSATION_WORKSPACE?version=2017-05-26&export=true" > conversation-ats-informatica.tmp.json

if [ $? -gt 0 ]
then
	echo "Falhou em baixar o backup"
	exit 1
fi

cp conversation-ats-informatica.tmp.json conversation-ats-informatica.json
rm conversation-ats-informatica.tmp.json

source ./formata.sh

git add conversation-ats-informatica.json
git commit -m "Backup automatico do Conversation - WSH1"

