feat: update version to 2025.0.6 and enhance Channels class with new methods for channel management
This commit is contained in:
@@ -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": {
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user