1.0.2 โ€ข Published 3 years ago

dscst v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

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

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago