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

api-devup

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

api-devup - npm Package Compare versions

Comparing version 1.1.0 to 1.1.5

111

index.js
const fetch = require("node-fetch");
class Auth {
constructor(key) {
this.clientParams = {
this.settings = {
auth: key,

@@ -13,15 +13,99 @@ method: "POST",

getGroups: "https://api.dev-up.ru/method/vk.getGroups",
getApps: "https://api.dev-up.ru/method/vk.getApps",
getStickers: "https://api.dev-up.ru/method/vk.getStickers",
speech: "https://api.dev-up.ru/method/audio.speech",
profile: "https://api.dev-up.ru/method/profile.get",
},
};
}
async call(method, params) {
const res = await fetch(`https://api.dev-up.ru/method/${method}`, {
method: this.settings.method,
credentials: this.settings.credentials,
body: JSON.stringify({
key: this.settings.auth.key,
...params,
}),
headers: this.settings.headers,
});
this.res = await res.json();
if (this.res.err) {
return this.res;
}
return this.res.response;
}
async audioSpeech(params) {
if (params && !params.url) {
return {
err: `The "url" parameter was not passed in the request. This parameter can be passed as follows: { url: "link to audio" }, set the correct order of parameters and try again!`,
};
}
const res = await fetch(this.settings.url.speech, {
method: this.settings.method,
credentials: this.settings.credentials,
body: JSON.stringify({
key: this.settings.auth.key,
...params,
}),
headers: this.settings.headers,
});
this.res = await res.json();
if (this.res.err) {
return this.res;
}
return this.res.response;
}
async getProfile(params) {
if (params) {
return { err: "This method does not need parameters!" };
}
const res = await fetch(this.settings.url.profile, {
method: this.settings.method,
credentials: this.settings.credentials,
body: JSON.stringify({
key: this.settings.auth.key,
}),
headers: this.settings.headers,
});
this.res = await res.json();
if (this.res.err) {
return this.res;
}
return this.res.response;
}
async getApps(params) {
if (params && !params.user_id) {
return {
err: 'The key parameter was not passed. Example {"user_id": number }!',
};
}
const res = await fetch(this.settings.url.getApps, {
method: this.settings.method,
credentials: this.settings.credentials,
body: JSON.stringify({
key: this.settings.auth.key,
...params,
}),
headers: this.settings.headers,
});
this.res = await res.json();
if (this.res.err) {
return this.res;
}
return this.res.response;
}
async getGroups(params) {
const res = await fetch(this.clientParams.url.getGroups, {
method: this.clientParams.method,
credentials: this.clientParams.credentials,
if (!params.user_id) {
return {
err: `The key parameter was not passed. Example {"user_id": number }!`,
};
}
const res = await fetch(this.settings.url.getGroups, {
method: this.settings.method,
credentials: this.settings.credentials,
body: JSON.stringify({
key: this.clientParams.auth.key,
key: this.settings.auth.key,
...params,
}),
headers: this.clientParams.headers,
headers: this.settings.headers,
});

@@ -35,10 +119,15 @@ this.res = await res.json();

async getStickers(params) {
const res = await fetch(this.clientParams.url.getStickers, {
method: this.clientParams.method,
credentials: this.clientParams.credentials,
if (!params.user_id) {
return {
err: 'The key parameter was not passed. Example {"user_id": number }!',
};
}
const res = await fetch(this.settings.url.getStickers, {
method: this.settings.method,
credentials: this.settings.credentials,
body: JSON.stringify({
key: this.clientParams.auth.key,
key: this.settings.auth.key,
...params,
}),
headers: this.clientParams.headers,
headers: this.settings.headers,
});

@@ -45,0 +134,0 @@ this.res = await res.json();

2

package.json
{
"name": "api-devup",
"version": "1.1.0",
"version": "1.1.5",
"description": "This library is intended for interaction with the service dev-up.ru",

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

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