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

@akkadu/rsi-api-base

Package Overview
Dependencies
Maintainers
5
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@akkadu/rsi-api-base - npm Package Compare versions

Comparing version 0.2.4 to 0.2.7

30

lib/index.d.ts
export default class Base {
emitter: any;
constructor();
gatewayRequest(apiKey: string, roomName: string): {
auth: {
uid: number;
channel: string;
appId: string;
token: string;
rtmToken: string;
};
publishers: {
id: number;
userId: number;
eventId: number;
pairId: string;
interpreterId: number;
language: string;
sourceLanguage: boolean;
sourceLanguageId: number;
interpreterLevel: number;
interpreterNeeded: boolean;
createdAt: string;
updatedAt: string;
}[];
floorLang: string;
userType: string;
};
gatewayRequest(apiKey: string, roomName: string): Promise<{
stream: any;
languageState: any;
eventLanguages: any;
}>;
on(event: any, fn: any): void;
}

131

lib/index.js
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var events_1 = require("events");
/* const axios = require('axios') */
var Base = /** @class */ (function () {

@@ -9,59 +46,41 @@ function Base() {

Base.prototype.gatewayRequest = function (apiKey, roomName) {
if (!apiKey) {
throw Error('base akadu-rsi: apiKey is undefined.');
}
if (!roomName) {
throw Error('base akkadu-rsi: roomname is undefined.');
}
// we get the stream /events/{eventId}/streams
var streamTest = {
"auth": {
"uid": 0,
"channel": "string",
"appId": "string",
"token": "string",
"rtmToken": "string"
},
"publishers": [
{
"id": 0,
"userId": 0,
"eventId": 0,
"pairId": "string",
"interpreterId": 0,
"language": "string",
"sourceLanguage": true,
"sourceLanguageId": 0,
"interpreterLevel": 0,
"interpreterNeeded": true,
"createdAt": "2021-05-25T07:49:48.840Z",
"updatedAt": "2021-05-25T07:49:48.840Z"
var _a, _b, _c;
return __awaiter(this, void 0, void 0, function () {
var eventRequest, eventId, streamRequest, eventLanguagesRequest, eventLanguageState, stream, eventLanguages, languageState;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
if (!apiKey) {
throw Error('base akadu-rsi: apiKey is undefined.');
}
if (!roomName) {
throw Error('base akkadu-rsi: roomName is undefined.');
}
return [4 /*yield*/, fetch("https://devapi.akkadu.com/v2/events/?roomName=" + roomName)];
case 1: return [4 /*yield*/, (_d.sent()).json()];
case 2:
eventRequest = _d.sent();
eventId = (_c = (_b = (_a = eventRequest === null || eventRequest === void 0 ? void 0 : eventRequest.data) === null || _a === void 0 ? void 0 : _a.events) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.id;
if (!eventId) {
throw Error('no eventId for this event');
}
return [4 /*yield*/, fetch("https://devapi.akkadu.com/v2/events/" + eventId + "/streams")];
case 3: return [4 /*yield*/, (_d.sent()).json()];
case 4:
streamRequest = _d.sent();
return [4 /*yield*/, (fetch("https://devapi.akkadu.com/v2/events/" + eventId + "/languages"))];
case 5: return [4 /*yield*/, (_d.sent()).json()];
case 6:
eventLanguagesRequest = _d.sent();
return [4 /*yield*/, (fetch("https://devapi.akkadu.com/v2/language-state?roomname=" + roomName))];
case 7: return [4 /*yield*/, (_d.sent()).json()];
case 8:
eventLanguageState = _d.sent();
stream = streamRequest === null || streamRequest === void 0 ? void 0 : streamRequest.data;
eventLanguages = eventLanguagesRequest === null || eventLanguagesRequest === void 0 ? void 0 : eventLanguagesRequest.data.languages;
languageState = eventLanguageState === null || eventLanguageState === void 0 ? void 0 : eventLanguageState.data.languageState;
return [2 /*return*/, { stream: stream, languageState: languageState, eventLanguages: eventLanguages }];
}
],
"floorLang": "en-US",
"userType": "string"
};
var eventTest = {
bio: null,
countryCode: null,
createdAt: "2020-10-09T04:07:43.879Z",
endDate: "2021-05-13T15:07:00.000Z",
eventUrl: null,
id: 2545,
isActive: true,
isAkkaduEvent: true,
isPrivate: false,
language: null,
location: null,
name: "testApi2",
pdfUrl: null,
posterUrl: null,
roomName: "pkmj",
startDate: "2021-05-12T21:07:00.000Z",
tagIds: [4],
timeZone: null,
updatedAt: "2021-05-13T04:52:47.934Z",
userId: 622
};
return streamTest;
});
});
};

@@ -68,0 +87,0 @@ Base.prototype.on = function (event, fn) {

{
"name": "@akkadu/rsi-api-base",
"version": "0.2.4",
"version": "0.2.7",
"description": "",

@@ -22,9 +22,11 @@ "main": "lib/index.js",

"license": "MIT",
"devDependencies": {
"dependencies": {
"@akkadu/browser-info": "^2.5.3",
"prettier": "^2.3.0",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0",
"typescript": "^4.2.4"
"typescript": "^4.2.4",
"ua-parser-js": "^0.7.21"
},
"gitHead": "e823373a0ae159cdce61912c6ce5e5940b6ce802"
"gitHead": "97db53df4dbc121b78b67dac7a3bf434b1e3db3f"
}
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