From 15a6f1ac81a4660d800b325dce2821015f2a1044 Mon Sep 17 00:00:00 2001 From: Alexander Zinn Date: Tue, 19 Aug 2025 13:25:09 -0400 Subject: [PATCH] feat: update version to 2025.0.6 and enhance Channels class with new methods for channel management --- package.json | 2 +- src/pcast/Channels.ts | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9c26acc..32861a9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@techniker-me/pcast-api", - "version": "2025.0.5", + "version": "2025.0.6", "module": "dist/node/index.js", "type": "module", "scripts": { diff --git a/src/pcast/Channels.ts b/src/pcast/Channels.ts index 092e09e..83d334d 100644 --- a/src/pcast/Channels.ts +++ b/src/pcast/Channels.ts @@ -61,7 +61,7 @@ export class Channels { } } - public async create(name: string, description: string, channelOptions: string[] = []): Promise { + public async createChannel(name: string, description: string, channelOptions: string[] = []): Promise { // Input validation if (!name || name.trim().length === 0) { throw new ChannelError('Channel name cannot be empty', 'INVALID_NAME'); @@ -108,6 +108,10 @@ export class Channels { return response.channels; } + public async getChannelInfoByAlias(alias: string): Promise { + return this.get({alias}); + } + public async get({alias, channelId}: GetChannelParams): Promise { if (!alias && !channelId) { throw new ChannelError('Either alias or channelId must be provided', 'MISSING_PARAMETER'); @@ -141,6 +145,12 @@ export class Channels { } } + public async getChannelPublisherCount(channelId: string): Promise { + const response = await this._httpRequests.request(HttpMethod.GET, `/channel/${encodeURIComponent(channelId)}/publishers/count`); + + return parseInt(response); + } + public async getMembers(channelId: string): Promise { if (!channelId || channelId.trim().length === 0) { throw new ChannelError('Channel ID cannot be empty', 'INVALID_CHANNEL_ID'); @@ -155,6 +165,10 @@ export class Channels { return response.members; } + public async deleteChannel(channelId: string): Promise { + return this.delete(channelId); + } + public async delete(channelId: string): Promise { if (!channelId || channelId.trim().length === 0) { throw new ChannelError('Channel ID cannot be empty', 'INVALID_CHANNEL_ID');