This commit is contained in:
Alex Zinn
2025-08-30 20:28:53 -04:00
parent 96dd978d5d
commit bbed095926
11 changed files with 15 additions and 16 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@techniker-me/pcast-api",
"version": "2025.1.0",
"version": "2025.1.4",
"type": "module",
"scripts": {
"ci-build": "bun run build",
@@ -19,10 +19,9 @@
"build:browser:dev": "bun build src/index.ts --outdir dist/browser --target browser --format esm --development",
"build:types:dev": "tsc --emitDeclarationOnly --outDir dist/types",
"prebuild:dev": "bun run clean",
"build:dev": "bun run build:node:dev && bun run build:browser:dev && bun run build:types:dev",
"build:dev": "bun run build:node:dev;bun run build:browser:dev;bun run build:types:dev",
"prebuild": "bun run clean",
"build": "bun run build:node && bun run build:browser && bun run build:types",
"postclean": "bun run lint",
"clean": "rm -rf dist",
"prepublish": "bash scripts/pre-publish.sh"
},
@@ -59,6 +58,6 @@
"registry": "https://registry-node.techniker.me"
},
"files": [
"dist"
"dist/"
]
}

View File

@@ -1,4 +1,4 @@
import {Channels, Streams, type ApplicationCredentials, PCastHttpRequests, Reporting} from './pcast';
import {Channels, Streams, type ApplicationCredentials, PCastHttpRequests, Reporting} from './apis';
export class PCastApi {
private readonly _channels: Channels;
@@ -11,7 +11,7 @@ export class PCastApi {
this._reporting = reporting;
}
public static create(pcastUri: string, applicationCredentials: ApplicationCredentials): Promise<PCastApi> {
public static create(pcastUri: string, applicationCredentials: ApplicationCredentials): PCastApi {
const pcastHttpRequests = new PCastHttpRequests(pcastUri.replace(/\/+$/, '').endsWith('/pcast') ? pcastUri : `${pcastUri}/pcast`, applicationCredentials);
const channels = new Channels(pcastHttpRequests);
const streams = new Streams(pcastHttpRequests);

View File

@@ -50,7 +50,7 @@ export class Channels {
private readonly _httpRequests: PCastHttpRequests;
private readonly _channelsByAlias: Map<ChannelAlias, Channel> = new Map();
private constructor(pcastHttpRequests: PCastHttpRequests) {
constructor(pcastHttpRequests: PCastHttpRequests) {
this._httpRequests = pcastHttpRequests;
this.initialize();
}
@@ -156,7 +156,7 @@ export class Channels {
throw new ChannelError(`Channel not found: ${alias}`, 'CHANNEL_NOT_FOUND');
}
return this.getChannelMembers(channel.channelId);
return this.getMembers(channel.channelId);
}
public async delete({channelId, alias}: {channelId?: string; alias?: string}): Promise<Channel> {
@@ -170,7 +170,7 @@ export class Channels {
throw new ChannelError('Unable to find room to delete', 'NOT_FOUND');
}
const route = `/channel/${encodeURIComponent(channelId)}`;
const route = `/channel/${encodeURIComponent(channelIdToDelete)}`;
const response = await this._httpRequests.request<ChannelResponse>(HttpMethod.DELETE, route);
if (!response.channel) {

View File

@@ -1,14 +1,14 @@
import {PCastApi} from './PCastApi';
import type {Channels, Streams, Reporting, ReportKind, ViewingReportKind} from './pcast';
import type {Channels, Streams, Reporting, ReportKind, ViewingReportKind} from './apis';
import type {ChannelId, Channel, ChannelAlias, Member, ChannelError} from './pcast/Channels';
import type {ChannelId, Channel, ChannelAlias, Member, ChannelError} from './apis/Channels';
import type {HttpMethod} from './net/http/HttpMethod';
import type {HttpRequestError} from './net/http/HttpRequests';
import type {ChannelResponse, ChannelsResponse, MembersResponse} from './pcast/IResponse';
import type {ApplicationCredentials} from './pcast/PCastRequests';
import type {PublishingReportOptions, ViewingReportOptions} from './pcast/Reporting';
import type {ReportKindType} from './pcast/ReportKind';
import type {ViewingReportKindType} from './pcast/ViewingReportKind';
import type {ChannelResponse, ChannelsResponse, MembersResponse} from './apis/IResponse';
import type {ApplicationCredentials} from './apis/PCastRequests';
import type {PublishingReportOptions, ViewingReportOptions} from './apis/Reporting';
import type {ReportKindType} from './apis/ReportKind';
import type {ViewingReportKindType} from './apis/ViewingReportKind';
export type {Channels, Streams, Reporting, ReportKind, ViewingReportKind};
export type {ChannelId, Channel, ChannelAlias, Member, ChannelError};