dscst v1.0.2
๐ฎ dscst
An asynchronous api wrapper around discord.style built with typescript
typescript recommended, too lazy for documentation rn
Installation
npm
npm i dscst
yarn
yarn add dscst
Usage
๐ get an api key
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.
๐คนโโ๏ธ Utility based wrapper
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.
typescript
import * as dscst from 'dscst';
javascript
const dscst = require('dscst');
โ example usage
// 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
๐ด Class based wrapper
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.
typescript
import { discordstyle } from 'dscst';
javascript
const { discordstyle } = require('dscst');
๐จ initialize class
const dscst = new discordstyle('api_key');
โ example usages (1)
// 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();
โ example usages (2)
// get template payload
const template = await dscst.template('template_id').get();
// like a template
const liked = await dscst.template('template_id').like();