Open chrlschwb opened 1 year ago
Schema for DB
all data will be stored in four fields
type, value, epoch, date_time
Type: the name of the data
Value: the value of the data at the given time
Epoch: incrementally increasing number
Date_Time: the time at which value was stored in the db
Schema for dashboard API
Single API endpoint to fetch all datapoints for a given period like this
/dashboard-api/2023-09-01T00:00:00/2023-09-02T00:00:00
Response would be like
[
{
{
type: telegram_follower,
value: 100,
epoch: 1,
date_time: 2023-09-01T00:00:00
},
{
type: telegram_posts,
value: 50,
epoch: 1,
date_time: 2023-09-01T00:00:00
}
...
},
{
{
type: telegram_follower,
value: 100,
epoch: 2,
date_time: 2023-09-01T00:01:00
},
{
type: telegram_posts,
value: 50,
epoch: 2,
date_time: 2023-09-01T00:01:00
}
...
}
]
I do not believe this is a complete proposal, for example I do not see anything for "daily active accounts" ?
Please, again, go through the full brief and make sure you address all data points, otherwise we will incurr costly delays.
Please read the requirements, this proposal does not even begin to satisfy it.
https://twitter.com/JoystreamDAO/
(twitter API) <1sconst T = new Twit({ consumer_key: '...', consumer_secret: '...', access_token: '...', access_token_secret: '...', timeout_ms: 60*1000, // optional HTTP request timeout to apply to all requests. });
T.get('users/show', { screen_name: 'username' }, function(err, data, response) { console.log(data.followers_count); });
const Twit = require('twit');
const T = new Twit({ consumer_key: '...', consumer_secret: '...', access_token: '...', access_token_secret: '...', timeout_ms: 60*1000, // optional HTTP request timeout to apply to all requests. });
T.get('users/show', { screen_name: 'username' }, function(err, data, response) { console.log(data.statuses_count); });
const { google } = require('googleapis'); const OAuth2 = google.auth.OAuth2;
const CLIENT_ID = 'YOUR_CLIENT_ID'; const CLIENT_SECRET = 'YOUR_CLIENT_SECRET'; const REDIRECT_URI = 'YOUR_REDIRECT_URI'; const REFRESH_TOKEN = 'YOUR_REFRESH_TOKEN';
const oauth2Client = new OAuth2( CLIENT_ID, CLIENT_SECRET, REDIRECT_URI );
oauth2Client.setCredentials({ refresh_token: REFRESH_TOKEN });
const youtube = google.youtube({ version: 'v3', auth: oauth2Client });
const channelId = 'YOUR_CHANNEL_ID';
youtube.channels.list({ part: ['snippet', 'tatistics'], id: channelId }, (err, res) => { if (err) return console.log('The API returned an error: ' err);
const channel = res.data.items[0]; const statistics = channel.statistics;
console.log(
Total views: ${statistics.viewCount}
); console.log(Total subscribers: ${statistics.subscriberCount}
); console.log(Total videos: ${statistics.videoCount}
); });const Reddit = require('reddit');
const reddit = new Reddit({ userAgent: 'YOUR_USER_AGENT', clientId: 'YOUR_CLIENT_ID', clientSecret: 'YOUR_CLIENT_SECRET', refreshToken: 'YOUR_REFRESH_TOKEN' });
reddit.auth().then(() => { const username = 'YOUR_USERNAME';
reddit.get(
/user/${username}/about.json
).then(response => { const data = response.data;}); });
const axios = require('axios');
const API_KEY = 'YOUR_API_KEY'; const COMMUNITY_ID = '1';
axios.get(
https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest?id=${COMMUNITY_ID}&convert=USD
, { headers: { 'X-CMC_PRO_API_KEY': API_KEY } }).then(response => { const data = response.data; const community = data.data[COMMUNITY_ID]; const followers = community.quote.USD.followers; const posts = community.quote.posts;console.log(
JoystreamDAO community has ${followers} followers
); }).catch(error => { console.log(error); });const DeBank = require('debank.js');
const debank = new DeBank({ apiEndpoint: 'https://api.debank.com/api/v1', apiKey: 'YOUR_API_KEY' });
const username = 'YOUR_USERNAME';
debank.getUser(username).then(user => { console.log(
Username: ${user.username}
); console.log(Followers: ${user.followers}
); });const TelegramBot = require('node-telegram-bot-api');
const token = 'YOUR_API_TOKEN'; const bot = new TelegramBot(token, { polling: true });
const channel = 'JoyStreamOfficial'; let messages;
bot.getChatMembersCount(channel).then(count => { console.log(
Number of users: ${count}
); });const Discord = require('discord.js'); const client = new Discord.Client();
client.on('ready', () => { console.log(
Logged in as ${client.user.tag}!
); });client.on('message', msg => { if (msg.content === '!membercount') { const userCount = msg.guild.members.cache.filter(member => !member.user.bot).size; msg.reply(
Server user count: ${userCount}
); } });client.login('your-token-goes-here');
client.on('message', async msg => { if (msg.content === '!messagecount') { let totalMessageCount = 0;
} });
client.login('your-token-goes-here');
const axios = require('axios');
const token = 'YOUR_ACCESS_TOKEN'; const owner = 'Joystream'; const repo = 'joystream';
axios.get(
https://api.github.com/repos/${owner}/${repo}/contributors
, { headers: { 'Authorization':Bearer ${token}
} }).then(response => { const contributors = response.data;console.log(
Number of contributors: ${contributors.length}
); });const getPrice = async () => { try { const { data: { data }, } = await axios.get( "https://pro-api.coinmarketcap.com/v2/cryptocurrency/quotes/latest?slug=joystream&convert=USD", { // body: JSON.stringify(params), headers: { Accepts: "application/json", "X-CMC_PRO_API_KEY": API_KEY, }, } );
} catch (e) { // In case there are problems with the API, we just return 0.
} };
async calculateCirculatingSupply() { const VESTING_STRING_HEX = "0x76657374696e6720";
}
async totalIssuanceInJOY(blockHash?: Hash): Promise {
const issuanceInHAPI =
blockHash === undefined
? await this.api.query.balances.totalIssuance()
: await this.api.query.balances.totalIssuance.at(blockHash);
}
const apr = rewardHistory.length && !stakingInfo.total.toBn().isZero() ? last(rewardHistory) .eraReward.toBn() .muln(ERAS_PER_YEAR) .mul(validatorInfo.commission.toBn()) .div(stakingInfo.total.toBn()) .divn(10 ** 7) // Convert from Perbill to Percent .toNumber() : 0
channels(limit:1000000000,orderBy:createdAt_DESC,where:{totalVideosCreated_gt:0}){ id }
videos(limit:1,orderBy:createdAt_DESC){ id }
comments(limit:1000000000){ id }
videoReactions(limit:1000000000){ id
} commentReactions(limit:1000000000){ id }
nftIssuedEvents(limit:1000000000){ id }
nftBoughtEvents(limit:1000000){ id price } auctions(limit:1000000,where:{isCompleted_eq:true}){ id topBid{ amount } }
chain.getHeader
councilMembers(limit:1000){ member{ handle metadata{ externalResources{ type value } }
} accumulatedReward electedInCouncilId }
workingGroups{ id leader{ membership{ handle externalResources{ type value } }
} }