feat: update version to 2025.0.6 and enhance Channels class with new methods for channel management

This commit is contained in:
Alexander Zinn
2025-08-19 13:25:09 -04:00
parent 27ae7789ef
commit 15a6f1ac81
2 changed files with 16 additions and 2 deletions

View File

@@ -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": {

View File

@@ -61,7 +61,7 @@ export class Channels {
}
}
public async create(name: string, description: string, channelOptions: string[] = []): Promise<Channel> {
public async createChannel(name: string, description: string, channelOptions: string[] = []): Promise<Channel> {
// 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<Channel | undefined> {
return this.get({alias});
}
public async get({alias, channelId}: GetChannelParams): Promise<Channel | undefined> {
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<number> {
const response = await this._httpRequests.request<string>(HttpMethod.GET, `/channel/${encodeURIComponent(channelId)}/publishers/count`);
return parseInt(response);
}
public async getMembers(channelId: string): Promise<Channel[]> {
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<Channel> {
return this.delete(channelId);
}
public async delete(channelId: string): Promise<Channel> {
if (!channelId || channelId.trim().length === 0) {
throw new ChannelError('Channel ID cannot be empty', 'INVALID_CHANNEL_ID');