Update version to 2025.1.7 and modify delete method in Channels API to return status object

This commit is contained in:
2025-09-07 13:09:19 -04:00
parent bca1cde895
commit 39086b0f08
2 changed files with 7 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@techniker-me/pcast-api",
"version": "2025.1.6",
"version": "2025.1.7",
"type": "module",
"scripts": {
"ci-build": "bun run build",

View File

@@ -161,7 +161,7 @@ export class Channels {
return this.getMembers(channel.channelId);
}
public async delete({channelId, alias}: {channelId?: string; alias?: string}): Promise<Channel> {
public async delete({channelId, alias}: {channelId?: string; alias?: string}): Promise<{status: string}> {
if (!channelId && !alias) {
throw new ChannelError('Deleting a channel requires either a channelId or alias', 'INVALID_ARGUMENTS');
}
@@ -175,17 +175,15 @@ export class Channels {
const route = `/channel/${encodeURIComponent(channelIdToDelete)}`;
const response = await this._httpRequests.request<ChannelResponse>(HttpMethod.DELETE, route);
if (!response.channel) {
throw new ChannelError(`Invalid response format for deleted channel [${channelId}]`, 'INVALID_RESPONSE');
if (response.status !== 'ok') {
throw new ChannelError(`Failed to delete channel [${channelIdToDelete}]`, 'DELETE_FAILED');
}
const deletedChannel = response.channel;
if (this._channelsByAlias.has(deletedChannel.alias)) {
this._channelsByAlias.delete(deletedChannel.alias);
if (alias && this._channelsByAlias.has(alias)) {
this._channelsByAlias.delete(alias);
}
return deletedChannel;
return response;
}
async getPublishSourceStreamId(channelId: string, retryCount: number = 3): Promise<string | null> {