In this repl.it API, I plan to take advantage of everything. Adapted from replya.
const replit = require("replit-query")();
await replit.login("username", "password");
...
Each of these examples will require an instance of the client.
const client = require("replit-query")();
This is the root of basically all applications. PARAMS query: This is what will be your query. It will be implemented like this:
{
query
}
You may want to read up on graphQL. RETURN A return value will look something like
{
...
}
await client.query('userByUsername(username: "username"){karma}').karma;
await client.talk.userByUsername("username", ["karma"]).karma;
await client.talk.userById(2222, ["karma"]).karma;
await client.talk.leaderboard(5, ["karma"])[0].karma; // top 5, the first person's karma
await client.talk.commentById(123456, ["title"]).title;
await client.talk.posts(10, ["title"])[0].title; // newest post's title
await client.login("username", "password");
/*
=> {
username: ...,
email: ...,
...
auth_jwt: ...,
...
}
*/
await client.getLoginKey("username", "password"); // => 3Er%R4d3f...
They will be in the following form.
replit query error: ...
Note that errors are put within a .catch()
block.
Special thanks to m3l0f1 to which this is adapted from replya