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

@twurple/api-call

Package Overview
Dependencies
Maintainers
1
Versions
147
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@twurple/api-call - npm Package Compare versions

Comparing version 7.1.0-pre.0 to 7.1.0-pre.1

3

lib/apiCall.d.ts

@@ -15,4 +15,5 @@ import { type Response } from '@d-fischer/cross-fetch';

* @param fetchOptions Additional options to be passed to the `fetch` function.
* @param mockServerPort
*/
export declare function callTwitchApiRaw(options: TwitchApiCallOptions, clientId?: string, accessToken?: string, authorizationType?: string, fetchOptions?: TwitchApiCallFetchOptions): Promise<Response>;
export declare function callTwitchApiRaw(options: TwitchApiCallOptions, clientId?: string, accessToken?: string, authorizationType?: string, fetchOptions?: TwitchApiCallFetchOptions, mockServerPort?: number): Promise<Response>;
/**

@@ -19,0 +20,0 @@ * Makes a call to the Twitch API using given credentials.

@@ -20,7 +20,8 @@ "use strict";

* @param fetchOptions Additional options to be passed to the `fetch` function.
* @param mockServerPort
*/
async function callTwitchApiRaw(options, clientId, accessToken, authorizationType, fetchOptions = {}) {
async function callTwitchApiRaw(options, clientId, accessToken, authorizationType, fetchOptions = {}, mockServerPort) {
var _a, _b;
const type = (_a = options.type) !== null && _a !== void 0 ? _a : 'helix';
const url = (0, url_1.getTwitchApiUrl)(options.url, type);
const url = (0, url_1.getTwitchApiUrl)(options.url, type, mockServerPort);
const params = (0, qs_1.stringify)(options.query, { arrayFormat: 'repeat', addQueryPrefix: true });

@@ -27,0 +28,0 @@ // eslint-disable-next-line @typescript-eslint/naming-convention

@@ -5,6 +5,14 @@ "use strict";

/** @internal */
function getTwitchApiUrl(url, type) {
function getTwitchApiUrl(url, type, mockServerPort) {
switch (type) {
case 'helix':
return `https://api.twitch.tv/helix/${url.replace(/^\//, '')}`;
case 'helix': {
const unprefixedUrl = url.replace(/^\//, '');
if (mockServerPort) {
if (unprefixedUrl === 'eventsub/subscriptions') {
return `http://localhost:${mockServerPort}/${unprefixedUrl}`;
}
return `http://localhost:${mockServerPort}/mock/${unprefixedUrl}`;
}
return `https://api.twitch.tv/helix/${unprefixedUrl}`;
}
case 'auth':

@@ -11,0 +19,0 @@ return `https://id.twitch.tv/oauth2/${url.replace(/^\//, '')}`;

{
"name": "@twurple/api-call",
"version": "7.1.0-pre.0",
"version": "7.1.0-pre.1",
"publishConfig": {

@@ -37,3 +37,3 @@ "access": "public"

"@d-fischer/shared-utils": "^3.6.1",
"@twurple/common": "7.1.0-pre.0",
"@twurple/common": "7.1.0-pre.1",
"tslib": "^2.0.3"

@@ -40,0 +40,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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