Skip to content

Commit

Permalink
Added test program
Browse files Browse the repository at this point in the history
  • Loading branch information
nicnacnic authored Apr 30, 2021
1 parent c86b7b2 commit b3723c5
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tiltifyTest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
const fs = require('fs');
const fetch = require("node-fetch");
const readLine = require('readline');

const rl = readLine.createInterface({
input: process.stdin,
output: process.stdout,
});

rl.question('Campaign ID: ', (campaignID) => {
rl.question('Auth Token: ', (authToken) => {
fetch(`https://tiltify.com/api/v3/campaigns/${campaignID}`, {
method: 'GET',
headers: {
'Authorization': `Bearer ${authToken}`
},
dataType: 'json',
})
.then(response => response.json())
.then(json => {
tiltifyData = json;
console.log('----- Campaign Info -----');
console.log(tiltifyData);
})
fetch(`https://tiltify.com/api/v3/campaigns/${campaignID}/donations`, {
method: 'GET',
headers: {
'Authorization': `Bearer ${authToken}`
},
dataType: 'json',
})
.then(response => response.json())
.then(json => {
tiltifyData = json;
console.log('----- Donation Info -----');
console.log(tiltifyData);
})
rl.close();
});
});

0 comments on commit b3723c5

Please sign in to comment.