Update version to 2025.1.7 and modify delete method in Channels API to return status object
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@techniker-me/pcast-api",
|
"name": "@techniker-me/pcast-api",
|
||||||
"version": "2025.1.6",
|
"version": "2025.1.7",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"ci-build": "bun run build",
|
"ci-build": "bun run build",
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ export class Channels {
|
|||||||
return this.getMembers(channel.channelId);
|
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) {
|
if (!channelId && !alias) {
|
||||||
throw new ChannelError('Deleting a channel requires either a channelId or alias', 'INVALID_ARGUMENTS');
|
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 route = `/channel/${encodeURIComponent(channelIdToDelete)}`;
|
||||||
const response = await this._httpRequests.request<ChannelResponse>(HttpMethod.DELETE, route);
|
const response = await this._httpRequests.request<ChannelResponse>(HttpMethod.DELETE, route);
|
||||||
|
|
||||||
if (!response.channel) {
|
if (response.status !== 'ok') {
|
||||||
throw new ChannelError(`Invalid response format for deleted channel [${channelId}]`, 'INVALID_RESPONSE');
|
throw new ChannelError(`Failed to delete channel [${channelIdToDelete}]`, 'DELETE_FAILED');
|
||||||
}
|
}
|
||||||
|
|
||||||
const deletedChannel = response.channel;
|
if (alias && this._channelsByAlias.has(alias)) {
|
||||||
|
this._channelsByAlias.delete(alias);
|
||||||
if (this._channelsByAlias.has(deletedChannel.alias)) {
|
|
||||||
this._channelsByAlias.delete(deletedChannel.alias);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return deletedChannel;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getPublishSourceStreamId(channelId: string, retryCount: number = 3): Promise<string | null> {
|
async getPublishSourceStreamId(channelId: string, retryCount: number = 3): Promise<string | null> {
|
||||||
|
|||||||
Reference in New Issue
Block a user