Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dsgstng-api

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dsgstng-api - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3-b

59

app.js
const request = require('request'),
origin = 'https://api.dsgstng.com'
origin = 'https://api.dsgstng.com',
util = require('util')
class Api {
/**
*
* @param {string} token
* Api interface to iteract with dsgstng.com
* @param {string} [token] Need for stream api access
*/
constructor(token) {
this.token = token
this.token = token || ''
this.stream = {
resolution: {
/**
* @description Gets all available stream resolutions [Token needed]
*/
get: () => {
return new Promise((res, rej) => {
request.get(`${origin}/${this.token}/stream/resolution`, (err, response, body) => {
if (err) return rej(err)
request.get({
url: `${origin}/stream/resolution`,
qs: {
token: this.token
}
}, (err, response, body) => {
if (err) {
util.log(err)
return rej(err)
}
return res(JSON.parse(body).data)

@@ -21,5 +33,13 @@ })

},
/**
* @param {string} resolution Gets only this resolution [Token needed]
*/
post: (resolution) => {
return new Promise((res, rej) => {
request.post(`${origin}/${this.token}/resolution`, {
request.post({
url: `${origin}/stream/resolution`
}, {
qs: {
token: this.token
},
json: true,

@@ -30,3 +50,6 @@ body: {

}, (err, response, body) => {
if (err) return rej(err)
if (err) {
util.log(err)
return rej(err)
}
return res(JSON.parse(body).data)

@@ -40,6 +63,20 @@ })

schedule: {
get: () => {
/**@description Calendar schedule [No token needed]
* @param {object} params Calendar request params
* @param {string} [params.year] Year (default gets from Date.now())
* @param {string} [params.season] Anime season (example:'summer'or'spring')
*/
get: (params) => {
return new Promise((res, rej) => {
request.get(`${origin}/${this.token}/calendar/schedule`, (err, response, body) => {
if (err) return rej(err)
request.get({
uri: `${origin}/calendar/schedule`,
qs: {
year: params.year,
season: params.season
}
}, (err, response, body) => {
if (err) {
util.log(err)
return rej(err)
}
return res(JSON.parse(body).data)

@@ -46,0 +83,0 @@ })

2

package.json
{
"name": "dsgstng-api",
"version": "0.0.2",
"version": "0.0.3b",
"description": "Interface of interaction with dsgstng.com api",

@@ -5,0 +5,0 @@ "main": "app.js",

@@ -1,1 +0,16 @@

Interface of interaction with [dsgstng.com](https://dsgstng.com) api
Interface of interaction with [dsgstng.com](https://dsgstng.com) api
Docs soon
```
// api usage example
const Api = require('dsgstng-api')
const dsgstngApi = new Api() // OR if you had token, put it there.
dsgstngApi.stream.resolution.get()
.then(resolution => {
// Do something
})
.catch(err => {
// Display error
})
```
For more details contact [him](https://t.me/ejnshtein)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc