New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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

43

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(`${origin}/stream/resolution?token=${this.token}`, (err, response, body) => {
if (err){
util.log(err)
return rej(err)
}
return res(JSON.parse(body).data)

@@ -21,5 +28,8 @@ })

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

@@ -30,3 +40,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 +53,14 @@ })

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(`${origin}/calendar/schedule`+ params ? `?year=${params.year ? params.year :new Date(Date.now()).getFullYear()}&season=${params.season}`:'' , (err, response, body) => {
if (err){
util.log(err)
return rej(err)
}
return res(JSON.parse(body).data)

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

{
"name": "dsgstng-api",
"version": "0.0.2",
"version": "0.0.3",
"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