Socket
Socket
Sign inDemoInstall

@twurple/api

Package Overview
Dependencies
Maintainers
2
Versions
146
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@twurple/api - npm Package Compare versions

Comparing version 5.0.0-pre.16 to 5.0.0-pre.17

es/api/helix/channel/HelixChannelReference.mjs

5

lib/api/helix/channel/HelixChannel.d.ts
import { DataObject } from '@twurple/common';
import type { ApiClient } from '../../../ApiClient';
import type { HelixGame } from '../game/HelixGame';
import type { HelixUser } from '../user/HelixUser';
/** @private */

@@ -35,2 +36,6 @@ export interface HelixChannelData {

/**
* Retrieves more information about the broadcaster of the channel.
*/
getBroadcaster(): Promise<HelixUser>;
/**
* The language of the channel.

@@ -37,0 +42,0 @@ */

@@ -35,2 +35,8 @@ "use strict";

/**
* Retrieves more information about the broadcaster of the channel.
*/
async getBroadcaster() {
return (await this._client.users.getUserById(this[common_1.rawDataSymbol].broadcaster_id));
}
/**
* The language of the channel.

@@ -37,0 +43,0 @@ */

5

lib/api/helix/clip/HelixClipApi.js

@@ -9,2 +9,3 @@ "use strict";

const HelixPaginatedResult_1 = require("../HelixPaginatedResult");
const HelixPagination_1 = require("../HelixPagination");
const HelixClip_1 = require("./HelixClip");

@@ -126,3 +127,3 @@ /**

async _getClips(params) {
const { filterType, ids, startDate, endDate, limit = 20 } = params;
const { filterType, ids, startDate, endDate, ...pagination } = params;
if (!ids.length) {

@@ -138,3 +139,3 @@ return { data: [] };

ended_at: endDate,
first: limit.toString()
...HelixPagination_1.makePaginationQuery(pagination)
}

@@ -141,0 +142,0 @@ });

42

lib/api/helix/extensions/HelixExtensionsApi.d.ts
import { BaseApi } from '../../BaseApi';
import { HelixChannelReference } from '../channel/HelixChannelReference';
import { HelixPaginatedRequest } from '../HelixPaginatedRequest';
import type { HelixPaginatedResult } from '../HelixPaginatedResult';
import type { HelixPagination } from '../HelixPagination';
import type { HelixForwardPagination, HelixPagination } from '../HelixPagination';
import { HelixExtension } from './HelixExtension';
import type { HelixExtensionBitsProductUpdatePayload } from './HelixExtensionBitsProduct';
import { HelixExtensionBitsProduct } from './HelixExtensionBitsProduct';
import type { HelixExtensionTransactionData } from './HelixExtensionTransaction';

@@ -34,2 +38,38 @@ import { HelixExtensionTransaction } from './HelixExtensionTransaction';

/**
* Retrieves a released extension by ID.
*
* @param extensionId The ID of the extension.
* @param version The version of the extension. If not given, retrieves the latest version.
*/
getReleasedExtension(extensionId: string, version?: string): Promise<HelixExtension>;
/**
* Retrieves a list of channels that are currently live and have the given extension installed.
*
* @param extensionId The ID of the extension.
* @param pagination
*
* @expandParams
*/
getLiveChannelsWithExtension(extensionId: string, pagination?: HelixForwardPagination): Promise<HelixPaginatedResult<HelixChannelReference>>;
/**
* Retrieves an extension's Bits products.
*
* This only works if the provided token belongs to an extension's client ID,
* and will return the products for that extension.
*
* @param includeDisabled Whether to include disabled/expired products.
*/
getExtensionBitsProducts(includeDisabled?: boolean): Promise<HelixExtensionBitsProduct[]>;
/**
* Creates or updates a Bits product of an extension.
*
* * This only works if the provided token belongs to an extension's client ID,
* and will create/update a product for that extension.
*
* @param data
*
* @expandParams
*/
putExtensionBitsProduct(data: HelixExtensionBitsProductUpdatePayload): Promise<HelixExtensionBitsProduct>;
/**
* Retrieves a list of transactions for the given extension.

@@ -36,0 +76,0 @@ *

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

const BaseApi_1 = require("../../BaseApi");
const HelixChannelReference_1 = require("../channel/HelixChannelReference");
const HelixPaginatedRequest_1 = require("../HelixPaginatedRequest");
const HelixPaginatedResult_1 = require("../HelixPaginatedResult");
const HelixPagination_1 = require("../HelixPagination");
const HelixExtension_1 = require("./HelixExtension");
const HelixExtensionBitsProduct_1 = require("./HelixExtensionBitsProduct");
const HelixExtensionTransaction_1 = require("./HelixExtensionTransaction");

@@ -25,2 +28,85 @@ /**

/**
* Retrieves a released extension by ID.
*
* @param extensionId The ID of the extension.
* @param version The version of the extension. If not given, retrieves the latest version.
*/
async getReleasedExtension(extensionId, version) {
const result = await this._client.callApi({
type: 'helix',
url: 'extensions/released',
query: {
extension_id: extensionId,
extension_version: version
}
});
return new HelixExtension_1.HelixExtension(result.data[0]);
}
/**
* Retrieves a list of channels that are currently live and have the given extension installed.
*
* @param extensionId The ID of the extension.
* @param pagination
*
* @expandParams
*/
async getLiveChannelsWithExtension(extensionId, pagination) {
const result = await this._client.callApi({
type: 'helix',
url: 'extensions/live',
query: {
extension_id: extensionId,
...HelixPagination_1.makePaginationQuery(pagination)
}
});
return HelixPaginatedResult_1.createPaginatedResult(result, HelixChannelReference_1.HelixChannelReference, this._client);
}
/**
* Retrieves an extension's Bits products.
*
* This only works if the provided token belongs to an extension's client ID,
* and will return the products for that extension.
*
* @param includeDisabled Whether to include disabled/expired products.
*/
async getExtensionBitsProducts(includeDisabled) {
const result = await this._client.callApi({
type: 'helix',
url: 'bits/extensions',
query: {
should_include_all: includeDisabled === null || includeDisabled === void 0 ? void 0 : includeDisabled.toString()
}
});
return result.data.map(data => new HelixExtensionBitsProduct_1.HelixExtensionBitsProduct(data));
}
/**
* Creates or updates a Bits product of an extension.
*
* * This only works if the provided token belongs to an extension's client ID,
* and will create/update a product for that extension.
*
* @param data
*
* @expandParams
*/
async putExtensionBitsProduct(data) {
const result = await this._client.callApi({
type: 'helix',
url: 'bits/extensions',
method: 'PUT',
jsonBody: {
sku: data.sku,
cost: {
amount: data.cost,
type: 'bits'
},
display_name: data.displayName,
in_development: data.inDevelopment,
expiration: data.expirationDate,
is_broadcast: data.broadcast
}
});
return new HelixExtensionBitsProduct_1.HelixExtensionBitsProduct(result.data[0]);
}
/**
* Retrieves a list of transactions for the given extension.

@@ -27,0 +113,0 @@ *

@@ -9,3 +9,3 @@ "use strict";

const common_1 = require("@twurple/common");
const StreamNotLiveError_1 = require("../../../Errors/StreamNotLiveError");
const StreamNotLiveError_1 = require("../../../errors/StreamNotLiveError");
const BaseApi_1 = require("../../BaseApi");

@@ -183,3 +183,3 @@ const HelixPaginatedRequest_1 = require("../HelixPaginatedRequest");

query: {
broadcaster: common_1.extractUserId(broadcaster)
broadcaster_id: common_1.extractUserId(broadcaster)
},

@@ -186,0 +186,0 @@ jsonBody: {

@@ -1,3 +0,3 @@

import type { HelixExtensionData } from './HelixExtension';
import { HelixExtension } from './HelixExtension';
import type { HelixBaseExtensionData } from './HelixBaseExtension';
import { HelixBaseExtension } from './HelixBaseExtension';
/**

@@ -12,7 +12,7 @@ * The possible extension slot types.

*/
export declare class HelixInstalledExtension extends HelixExtension {
export declare class HelixInstalledExtension extends HelixBaseExtension {
private readonly _slotType;
private readonly _slotId;
/** @private */
constructor(slotType: HelixExtensionSlotType, slotId: string, data: HelixExtensionData);
constructor(slotType: HelixExtensionSlotType, slotId: string, data: HelixBaseExtensionData);
/**

@@ -19,0 +19,0 @@ * The type of the slot the extension is in.

@@ -6,3 +6,3 @@ "use strict";

const common_1 = require("@twurple/common");
const HelixExtension_1 = require("./HelixExtension");
const HelixBaseExtension_1 = require("./HelixBaseExtension");
/**

@@ -13,3 +13,3 @@ * A Twitch Extension that is installed in a slot of a channel.

*/
let HelixInstalledExtension = class HelixInstalledExtension extends HelixExtension_1.HelixExtension {
let HelixInstalledExtension = class HelixInstalledExtension extends HelixBaseExtension_1.HelixBaseExtension {
/** @private */

@@ -16,0 +16,0 @@ constructor(slotType, slotId, data) {

import { DataObject } from '@twurple/common';
import type { HelixExtensionData } from './HelixExtension';
import type { HelixBaseExtensionData } from './HelixBaseExtension';
import type { HelixExtensionSlotType } from './HelixInstalledExtension';
import { HelixInstalledExtension } from './HelixInstalledExtension';
/** @private */
export interface HelixInstalledExtensionData extends HelixExtensionData {
export interface HelixInstalledExtensionData extends HelixBaseExtensionData {
active: true;

@@ -8,0 +8,0 @@ }

import { rawDataSymbol } from '@twurple/common';
import type { HelixExtensionData } from './HelixExtension';
import { HelixExtension } from './HelixExtension';
import type { HelixBaseExtensionData } from './HelixBaseExtension';
import { HelixBaseExtension } from './HelixBaseExtension';
import type { HelixExtensionSlotType } from './HelixInstalledExtension';

@@ -8,3 +8,3 @@ /** @private */

/** @private */
export interface HelixUserExtensionData extends HelixExtensionData {
export interface HelixUserExtensionData extends HelixBaseExtensionData {
can_activate: boolean;

@@ -18,3 +18,3 @@ type: HelixExtensionType[];

*/
export declare class HelixUserExtension extends HelixExtension {
export declare class HelixUserExtension extends HelixBaseExtension {
/** @private */ readonly [rawDataSymbol]: HelixUserExtensionData;

@@ -21,0 +21,0 @@ /**

@@ -6,3 +6,3 @@ "use strict";

const common_1 = require("@twurple/common");
const HelixExtension_1 = require("./HelixExtension");
const HelixBaseExtension_1 = require("./HelixBaseExtension");
/**

@@ -13,3 +13,3 @@ * A Twitch Extension that was installed by a user.

*/
let HelixUserExtension = class HelixUserExtension extends HelixExtension_1.HelixExtension {
let HelixUserExtension = class HelixUserExtension extends HelixBaseExtension_1.HelixBaseExtension {
/**

@@ -16,0 +16,0 @@ * Whether the user has configured the extension to be able to activate it.

@@ -59,7 +59,7 @@ import type { HelixUserType, UserIdResolvable, UserIdResolvableType, UserNameResolveableType } from '@twurple/common';

/**
* The URL to the profile picture of the user.
* The URL of the profile picture of the user.
*/
get profilePictureUrl(): string;
/**
* The URL to the offline video placeholder of the user.
* The URL of the offline video placeholder of the user.
*/

@@ -66,0 +66,0 @@ get offlinePlaceholderUrl(): string;

@@ -7,3 +7,3 @@ "use strict";

const common_1 = require("@twurple/common");
const NoSubscriptionProgramError_1 = require("../../../Errors/NoSubscriptionProgramError");
const NoSubscriptionProgramError_1 = require("../../../errors/NoSubscriptionProgramError");
/**

@@ -59,3 +59,3 @@ * A Twitch user.

/**
* The URL to the profile picture of the user.
* The URL of the profile picture of the user.
*/

@@ -66,3 +66,3 @@ get profilePictureUrl() {

/**
* The URL to the offline video placeholder of the user.
* The URL of the offline video placeholder of the user.
*/

@@ -69,0 +69,0 @@ get offlinePlaceholderUrl() {

@@ -30,3 +30,3 @@ "use strict";

const UnsupportedApi_1 = require("./api/unsupported/UnsupportedApi");
const ConfigError_1 = require("./Errors/ConfigError");
const ConfigError_1 = require("./errors/ConfigError");
/**

@@ -45,3 +45,5 @@ * An API client for the Twitch Helix API and other miscellaneous endpoints.

}
this._helixRateLimiter = new HelixRateLimiter_1.HelixRateLimiter({ logger: config.logger });
this._helixRateLimiter = new HelixRateLimiter_1.HelixRateLimiter({
logger: { name: 'twurple:api:rate-limiter', ...config.logger }
});
this._config = config;

@@ -48,0 +50,0 @@ }

@@ -109,3 +109,3 @@ export { ApiClient } from './ApiClient';

export type { HelixBroadcasterType, HelixUserData } from './api/helix/user/HelixUser';
export { HelixExtension } from './api/helix/user/Extensions/HelixExtension';
export { HelixBaseExtension } from './api/helix/user/Extensions/HelixBaseExtension';
export { HelixInstalledExtension } from './api/helix/user/Extensions/HelixInstalledExtension';

@@ -122,7 +122,7 @@ export type { HelixExtensionSlotType } from './api/helix/user/Extensions/HelixInstalledExtension';

export { ChattersList } from './api/unsupported/ChattersList';
export { ConfigError } from './Errors/ConfigError';
export { NoSubscriptionProgramError } from './Errors/NoSubscriptionProgramError';
export { StreamNotLiveError } from './Errors/StreamNotLiveError';
export { ConfigError } from './errors/ConfigError';
export { NoSubscriptionProgramError } from './errors/NoSubscriptionProgramError';
export { StreamNotLiveError } from './errors/StreamNotLiveError';
export { ChatEmote, extractUserId, extractUserName, HellFreezesOverError } from '@twurple/common';
export type { CheermoteBackground, CheermoteDisplayInfo, CommercialLength, CheermoteScale, CheermoteState, HelixUserType, UserIdResolvable, UserNameResolvable } from '@twurple/common';
//# sourceMappingURL=index.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HelixSchedule = exports.HelixScheduleApi = exports.HelixUserRelation = exports.HelixPredictor = exports.HelixPredictionOutcome = exports.HelixPrediction = exports.HelixPredictionApi = exports.HelixPollChoice = exports.HelixPoll = exports.HelixPollApi = exports.HelixModeratorEvent = exports.HelixModerator = exports.HelixBanEvent = exports.HelixBan = exports.HelixModerationApi = exports.HelixHypeTrainEvent = exports.HelixHypeTrainContribution = exports.HelixHypeTrainApi = exports.HelixGame = exports.HelixGameApi = exports.HelixExtensionTransaction = exports.HelixExtensionsApi = exports.HelixEventSubSubscription = exports.HelixEventSubApi = exports.HelixClip = exports.HelixClipApi = exports.HelixEmoteFromSet = exports.HelixChannelEmote = exports.HelixEmote = exports.HelixChatBadgeVersion = exports.HelixChatBadgeSet = exports.HelixChatApi = exports.HelixCustomRewardRedemption = exports.HelixCustomReward = exports.HelixChannelPointsApi = exports.HelixChannelEditor = exports.HelixChannel = exports.HelixChannelApi = exports.HelixCheermoteList = exports.HelixBitsLeaderboardEntry = exports.HelixBitsLeaderboard = exports.HelixBitsApi = exports.HelixPaginatedRequestWithTotal = exports.HelixPaginatedRequest = exports.HelixApiGroup = exports.ChatBadgeVersion = exports.ChatBadgeSet = exports.ChatBadgeList = exports.BadgesApi = exports.ApiClient = void 0;
exports.HellFreezesOverError = exports.extractUserName = exports.extractUserId = exports.ChatEmote = exports.StreamNotLiveError = exports.NoSubscriptionProgramError = exports.ConfigError = exports.ChattersList = exports.UnsupportedApi = exports.HelixVideo = exports.HelixVideoApi = exports.HelixUserExtension = exports.HelixInstalledExtensionList = exports.HelixInstalledExtension = exports.HelixExtension = exports.HelixUser = exports.HelixPrivilegedUser = exports.HelixFollow = exports.HelixUserBlock = exports.HelixUserApi = exports.HelixTeamWithUsers = exports.HelixTeam = exports.HelixTeamApi = exports.HelixTag = exports.HelixTagApi = exports.HelixSubscriptionEvent = exports.HelixSubscription = exports.HelixSubscriptionApi = exports.HelixStreamMarkerWithVideo = exports.HelixStreamMarker = exports.HelixStream = exports.HelixStreamApi = exports.HelixChannelSearchResult = exports.HelixSearchApi = exports.HelixPaginatedScheduleSegmentRequest = exports.HelixScheduleSegment = void 0;
exports.HellFreezesOverError = exports.extractUserName = exports.extractUserId = exports.ChatEmote = exports.StreamNotLiveError = exports.NoSubscriptionProgramError = exports.ConfigError = exports.ChattersList = exports.UnsupportedApi = exports.HelixVideo = exports.HelixVideoApi = exports.HelixUserExtension = exports.HelixInstalledExtensionList = exports.HelixInstalledExtension = exports.HelixBaseExtension = exports.HelixUser = exports.HelixPrivilegedUser = exports.HelixFollow = exports.HelixUserBlock = exports.HelixUserApi = exports.HelixTeamWithUsers = exports.HelixTeam = exports.HelixTeamApi = exports.HelixTag = exports.HelixTagApi = exports.HelixSubscriptionEvent = exports.HelixSubscription = exports.HelixSubscriptionApi = exports.HelixStreamMarkerWithVideo = exports.HelixStreamMarker = exports.HelixStream = exports.HelixStreamApi = exports.HelixChannelSearchResult = exports.HelixSearchApi = exports.HelixPaginatedScheduleSegmentRequest = exports.HelixScheduleSegment = void 0;
var ApiClient_1 = require("./ApiClient");

@@ -147,4 +147,4 @@ Object.defineProperty(exports, "ApiClient", { enumerable: true, get: function () { return ApiClient_1.ApiClient; } });

Object.defineProperty(exports, "HelixUser", { enumerable: true, get: function () { return HelixUser_1.HelixUser; } });
var HelixExtension_1 = require("./api/helix/user/Extensions/HelixExtension");
Object.defineProperty(exports, "HelixExtension", { enumerable: true, get: function () { return HelixExtension_1.HelixExtension; } });
var HelixBaseExtension_1 = require("./api/helix/user/Extensions/HelixBaseExtension");
Object.defineProperty(exports, "HelixBaseExtension", { enumerable: true, get: function () { return HelixBaseExtension_1.HelixBaseExtension; } });
var HelixInstalledExtension_1 = require("./api/helix/user/Extensions/HelixInstalledExtension");

@@ -164,7 +164,7 @@ Object.defineProperty(exports, "HelixInstalledExtension", { enumerable: true, get: function () { return HelixInstalledExtension_1.HelixInstalledExtension; } });

Object.defineProperty(exports, "ChattersList", { enumerable: true, get: function () { return ChattersList_1.ChattersList; } });
var ConfigError_1 = require("./Errors/ConfigError");
var ConfigError_1 = require("./errors/ConfigError");
Object.defineProperty(exports, "ConfigError", { enumerable: true, get: function () { return ConfigError_1.ConfigError; } });
var NoSubscriptionProgramError_1 = require("./Errors/NoSubscriptionProgramError");
var NoSubscriptionProgramError_1 = require("./errors/NoSubscriptionProgramError");
Object.defineProperty(exports, "NoSubscriptionProgramError", { enumerable: true, get: function () { return NoSubscriptionProgramError_1.NoSubscriptionProgramError; } });
var StreamNotLiveError_1 = require("./Errors/StreamNotLiveError");
var StreamNotLiveError_1 = require("./errors/StreamNotLiveError");
Object.defineProperty(exports, "StreamNotLiveError", { enumerable: true, get: function () { return StreamNotLiveError_1.StreamNotLiveError; } });

@@ -171,0 +171,0 @@ var common_1 = require("@twurple/common");

{
"name": "@twurple/api",
"version": "5.0.0-pre.16",
"version": "5.0.0-pre.17",
"publishConfig": {

@@ -39,8 +39,8 @@ "access": "public"

"@d-fischer/shared-utils": "^3.2.0",
"@twurple/api-call": "^5.0.0-pre.16",
"@twurple/common": "^5.0.0-pre.16",
"@twurple/api-call": "^5.0.0-pre.17",
"@twurple/common": "^5.0.0-pre.17",
"tslib": "^2.0.3"
},
"devDependencies": {
"@twurple/auth": "^5.0.0-pre.16"
"@twurple/auth": "^5.0.0-pre.17"
},

@@ -61,3 +61,3 @@ "peerDependencies": {

},
"gitHead": "6884845a0d7715ce8bfabcc27c74e2cc75f75e7c"
"gitHead": "520bef27d5081f0ec476f1c95ac60efd27797973"
}

@@ -7,2 +7,6 @@ # ⚠ WARNING

[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/twurple/twurple/blob/main/LICENSE)
[![npm version](https://img.shields.io/npm/v/@twurple/api.svg?style=flat)](https://www.npmjs.com/package/@twurple/api)
![PRs welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)
Interact with Twitch's API.

@@ -9,0 +13,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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