An asynchronous api wrapper around discord.style built with typescript
typescript recommended, too lazy for documentation rn
npm
npm i dscst
yarn
yarn add dscst
this is a temporary way of generating an api key, will be easier via frontend soon.
POST
https://api.discord.style/apikey
with cookie header
an api key will be returned in the payload json response.
Use the api wrapper via separated methods.
an api key has to be passed to every auth required method
returns full api response from request.
import * as dscst from 'dscst';
const dscst = require('dscst');
// non-auth
const info = await dscst.template.get('template_id');
console.log(info); // template response
// auth
const liked = await dscst.template.like('template_id', 'api_key');
console.log(liked); // liked template response
Use the api wrapper, nicely.
will soon contain cachable data from either in memory or redis client.
initialize the class with your api key, select and access methods from returned util classes
returns payload rather than the entire api response, rejects with api error message if success is false.
import { discordstyle } from 'dscst';
const { discordstyle } = require('dscst');
const dscst = new discordstyle('api_key');
// fetches template data and returns Template class with template methods
const template = await dscst.template('template_id');
// get template cached data from class
const cachedInfo = template.get(true);
// get fresh payload from api
const freshInfo = await template.get();
// like a template
const liked = await template.like();
// get template payload
const template = await dscst.template('template_id').get();
// like a template
const liked = await dscst.template('template_id').like();