Skip to content

๐Ÿ”ฎ asynchronous api wrapper around discord.style

License

Notifications You must be signed in to change notification settings

discord-style/dscst

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

17 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ”ฎ 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();

About

๐Ÿ”ฎ asynchronous api wrapper around discord.style

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published